diff --git a/generate_protos b/generate_protos index bc7a3aa..783c398 100755 --- a/generate_protos +++ b/generate_protos @@ -9,6 +9,7 @@ do --python_out=src/ \ --grpc_python_out=src/ \ --mypy_out=src/ \ + --mypy_grpc_out=src/ \ ${FILE} # FILE_NAME=$(basename -- "$FILE") @@ -27,6 +28,7 @@ do --proto_path=./schema/ \ --python_out=src/ \ --mypy_out=src/ \ + --mypy_grpc_out=src/ \ ${FILE} # FILE_NAME=$(basename -- "$FILE") diff --git a/pyproject.toml b/pyproject.toml index dc79898..8519d56 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,26 +1,30 @@ [build-system] -requires = ["setuptools >= 61.0"] build-backend = "setuptools.build_meta" +requires = ["setuptools >= 61.0"] [project] -name = "druncschema" +authors = [ + {name = "Pierre Lasorak", email = "p.lasorak@imperial.ac.uk"}, + {name = "Pawel Plesniak", email = "pawel.plesniak15@imperial.ac.uk"}, + {name = "Claudia Su", email = "claudia.su@physics.ox.ac.uk"}, + {name = "Emir Muhammad", email = "e.muhammad@imperial.ac.uk"}, + {name = "James Turner", email = "james.turner@imperial.ac.uk"}, + {name = "Aruash Karimi", email = "a.karimi@imperial.ac.uk"}, + {name = "Miruna Serian", email = "m.serian@imperial.ac.uk"}, +] +dependencies = [ + "click", + "grpcio", + "grpcio-status", + "grpcio-tools", + "googleapis-common-protos", + "rich", +] description = "Schema definitions and compilation script for drunc" -version = "1.1.0" +name = "druncschema" readme = "docs/README.md" requires-python = ">=3.10" -dependencies = [ - "click", - "grpcio", - "grpcio-status", - "grpcio-tools", - "googleapis-common-protos", - "rich", -] -authors = [ - {name = "Pierre Lasorak", email = "p.lasorak@imperial.ac.uk"}, - {name = "Pawel Plesniak", email = "pawel.plesniak15@imperial.ac.uk"}, - {name = "Claudia Su", email = "claudia.su@physics.ox.ac.uk"} -] +version = "1.1.0" [project.optional-dependencies] dev = ["ruff", "pre-commit", "pytest", "pytest-cov", "mypy-protobuf", "types-protobuf"] @@ -36,25 +40,24 @@ where = ["src"] addopts = "-v --tb=short --cov=druncschema --cov=src/druncschema tests/" [tool.coverage.run] -source = ["druncschema"] omit = ["tests/*", "scripts/*"] - +source = ["druncschema"] [tool.ruff] exclude = [ - "src/druncschema.egg-info", - "src/druncschema/*_pb2.py*", - "src/druncschema/*_pb2_grpc.py", + "src/druncschema.egg-info", + "src/druncschema/*_pb2.py*", + "src/druncschema/*_pb2_grpc.py*", ] [tool.ruff.lint] +pydocstyle.convention = "google" select = [ - "D", # pydocstyle - "E", # pycodestyle - "F", # Pyflakes - "I", # isort - "UP", # pyupgrade - "RUF", # ruff-specific rules - "R", # refactoring suggestions + "D", # pydocstyle + "E", # pycodestyle + "F", # Pyflakes + "I", # isort + "UP", # pyupgrade + "RUF", # ruff-specific rules + "R", # refactoring suggestions ] -pydocstyle.convention = "google" diff --git a/scripts/generate_protos.py b/scripts/generate_protos.py index f335b4c..c4f5e6e 100755 --- a/scripts/generate_protos.py +++ b/scripts/generate_protos.py @@ -2,17 +2,17 @@ """Defines command to compile *.proto files. -Compiles buffers into +Compiles buffers into - *pb2.py. - *pb2.pyi. - - pb2_grpc.py. + - *pb2_grpc.py. + - *pb2_grpc.pyi. """ import importlib import logging import os import subprocess -from importlib.resources import files from pathlib import Path import click @@ -32,17 +32,21 @@ width = os.get_terminal_size()[0] except OSError: width = 150 - -log.addHandler(RichHandler( - console=Console(width=width), - omit_repeated_times=False, - markup=True, - rich_tracebacks=True, - show_path=False, - tracebacks_width=width, -)) - -compiled_extensions = ["_pb2.py", "_pb2.pyi", "_pb2_grpc.py"] + +log.addHandler( + RichHandler( + console=Console(width=width), + omit_repeated_times=False, + markup=True, + rich_tracebacks=True, + show_path=False, + tracebacks_width=width, + ) +) + +compiled_extensions = ["_pb2.py", "_pb2.pyi", "_pb2_grpc.py", "_pb2_grpc.pyi"] + + def in_dev_mode(): """Check if in dev mode. @@ -53,27 +57,32 @@ def in_dev_mode(): return True return False + def generate_protos( - source_path: Path, - druncschema_root: Path, - proto_files: list[Path], - output_dir: Path, - subdir: Path) -> None: + source_path: Path, + druncschema_root: Path, + proto_files: list[Path], + output_dir: Path, + subdir: Path, +) -> None: """Compiles the protobuf messages.""" for proto_file in proto_files: log.info(f"Processing file {proto_file!s} to output dir {output_dir!s}") if not str(proto_file).endswith(".proto"): raise Exception(f"File names must end in a '.proto', received {proto_file}") try: - cmd = " ".join([ - f"source {source_path}; cd {druncschema_root}; " - "python -m grpc_tools.protoc", - "-I'./schema'", - f"--python_out={output_dir!s}", - f"--grpc_python_out={output_dir!s}", - f"--mypy_out={output_dir!s}", - str(proto_file), - ]) + cmd = " ".join( + [ + f"source {source_path}; cd {druncschema_root}; " + "python -m grpc_tools.protoc", + "-I'./schema'", + f"--python_out={output_dir!s}", + f"--grpc_python_out={output_dir!s}", + f"--mypy_out={output_dir!s}", + f"--mypy_grpc_out={output_dir!s}", + str(proto_file), + ] + ) log.debug(cmd) subprocess.run( cmd, @@ -81,15 +90,16 @@ def generate_protos( text=True, check=True, shell=True, - executable="/bin/bash" + executable="/bin/bash", ) except subprocess.CalledProcessError as e: log.exception(e) log.error(e.stderr) output_files = [ - output_dir / Path("druncschema") / subdir / Path( - Path(proto_file.name).stem + extension - ) + output_dir + / Path("druncschema") + / subdir + / Path(Path(proto_file.name).stem + extension) for extension in compiled_extensions ] for output_file in output_files: @@ -100,24 +110,27 @@ def generate_protos( else: log.debug(f"Generated {output_file}") + def clear_previous_compiled_schema(output_dir: Path, output_files: list[Path]) -> None: """Delete previous results of schema compilation.""" for output_file in output_files: for compiled_extension in compiled_extensions: existing_file = output_dir / output_file.with_name( - output_file.stem + compiled_extension) + output_file.stem + compiled_extension + ) if existing_file.exists(): log.info(f"Deleting file {existing_file}") existing_file.unlink() + def call_generate_protos( - source_path: Path, - druncschema_root: Path, - output_dir: Path, - subdir: Path, - clean: bool, - do_not_compile: bool - ) -> None: + source_path: Path, + druncschema_root: Path, + output_dir: Path, + subdir: Path, + clean: bool, + do_not_compile: bool, +) -> None: """Clear existing compiled buffers, compile new buffers. List *.proto files. @@ -126,15 +139,14 @@ def call_generate_protos( """ proto_relative_path = Path("schema/druncschema") proto_files = [ - proto_relative_path / subdir / Path(f.name) + proto_relative_path / subdir / Path(f.name) for f in (druncschema_root / proto_relative_path / subdir).glob("*.proto") ] if not proto_files: return if clean: clear_previous_compiled_schema( - output_dir / Path("druncschema") / subdir, - proto_files + output_dir / Path("druncschema") / subdir, proto_files ) if get_files(output_dir): e = Exception("Not all files removed, exiting") @@ -144,17 +156,28 @@ def call_generate_protos( generate_protos(source_path, druncschema_root, proto_files, output_dir, subdir) return -def get_subdirs(path: Path) ->list[str]: + +def get_subdirs(path: Path) -> list[str]: """Generate list of relevant directories.""" - return [Path(p.name) for p in path.iterdir() - if p.is_dir() and not str(p.name).endswith("__") - and not str(p.name).endswith("apps")] + return [ + Path(p.name) + for p in path.iterdir() + if p.is_dir() + and not str(p.name).endswith("__") + and not str(p.name).endswith("apps") + ] + -def get_files(path: Path) ->list[Path]: +def get_files(path: Path) -> list[Path]: """Generate list of *.proto files.""" - return [Path(p.name) for p in path.iterdir() - if p.is_file() and not str(p.name).endswith("__.py") - and not str(p.name).endswith("typed")] + return [ + Path(p.name) + for p in path.iterdir() + if p.is_file() + and not str(p.name).endswith("__.py") + and not str(p.name).endswith("typed") + ] + @click.command() @click.option( @@ -168,7 +191,7 @@ def get_files(path: Path) ->list[Path]: "-c", "--clean", is_flag=True, - help="Explicitly deletes the existing compiled schemas " \ + help="Explicitly deletes the existing compiled schemas " "before starting the compile the new ones", ) @click.option( @@ -181,13 +204,13 @@ def main( log_level: str, clean: bool, do_not_compile: bool, - ) -> None: +) -> None: """Compile the protobuf message schema into the relevant python code.""" log.setLevel(log_level) if not in_dev_mode(): e = Exception( - "This command is only available in developer mode." \ + "This command is only available in developer mode." "See the druncschema wiki for further clarification." ) log.exception(e) @@ -198,7 +221,7 @@ def main( ) log.exception(e) - druncschema_root = Path(f'{os.environ["DBT_AREA_ROOT"]}/sourcecode/druncschema') + druncschema_root = Path(f"{os.environ['DBT_AREA_ROOT']}/sourcecode/druncschema") log.debug(f"Found druncschema directory at {druncschema_root}") output_dir = druncschema_root / "src/" @@ -209,23 +232,14 @@ def main( subdir = Path() call_generate_protos( - source_path, - druncschema_root, - output_dir, - subdir, - clean, - do_not_compile + source_path, druncschema_root, output_dir, subdir, clean, do_not_compile ) subdirs = get_subdirs(druncschema_root / Path("schema/druncschema")) for subdir in subdirs: call_generate_protos( - source_path, - druncschema_root, - output_dir, - subdir, - clean, - do_not_compile + source_path, druncschema_root, output_dir, subdir, clean, do_not_compile ) + main() diff --git a/src/druncschema/authoriser_pb2_grpc.pyi b/src/druncschema/authoriser_pb2_grpc.pyi new file mode 100644 index 0000000..e62dfb0 --- /dev/null +++ b/src/druncschema/authoriser_pb2_grpc.pyi @@ -0,0 +1,21 @@ +"""@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" + +import abc as _abc_1 +import typing as _typing +from collections import abc as _abc + +import grpc as _grpc +from grpc import aio as _aio + +_T = _typing.TypeVar("_T") + +class _MaybeAsyncIterator( + _abc.AsyncIterator[_T], _abc.Iterator[_T], metaclass=_abc_1.ABCMeta +): ... +class _ServicerContext(_grpc.ServicerContext, _aio.ServicerContext): # type: ignore[misc, type-arg] + ... + +GRPC_GENERATED_VERSION: str +GRPC_VERSION: str diff --git a/src/druncschema/controller_pb2_grpc.pyi b/src/druncschema/controller_pb2_grpc.pyi new file mode 100644 index 0000000..a5a0956 --- /dev/null +++ b/src/druncschema/controller_pb2_grpc.pyi @@ -0,0 +1,230 @@ +"""@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" + +import abc as _abc_1 +import sys +import typing as _typing +from collections import abc as _abc + +import grpc as _grpc +from grpc import aio as _aio + +from druncschema import controller_pb2 as _controller_pb2 + +if sys.version_info >= (3, 11): + from typing import Self as _Self +else: + from typing_extensions import Self as _Self + +_T = _typing.TypeVar("_T") + +class _MaybeAsyncIterator( + _abc.AsyncIterator[_T], _abc.Iterator[_T], metaclass=_abc_1.ABCMeta +): ... +class _ServicerContext(_grpc.ServicerContext, _aio.ServicerContext): # type: ignore[misc, type-arg] + ... + +GRPC_GENERATED_VERSION: str +GRPC_VERSION: str + +class ControllerStub: + @_typing.overload + def __new__(cls, channel: _grpc.Channel) -> _Self: ... + @_typing.overload + def __new__(cls, channel: _aio.Channel) -> ControllerAsyncStub: ... + describe: _grpc.UnaryUnaryMultiCallable[ + _controller_pb2.DescribeRequest, _controller_pb2.DescribeResponse + ] + status: _grpc.UnaryUnaryMultiCallable[ + _controller_pb2.StatusRequest, _controller_pb2.StatusResponse + ] + describe_fsm: _grpc.UnaryUnaryMultiCallable[ + _controller_pb2.DescribeFSMRequest, _controller_pb2.DescribeFSMResponse + ] + execute_fsm_command: _grpc.UnaryUnaryMultiCallable[ + _controller_pb2.ExecuteFSMCommandRequest, + _controller_pb2.ExecuteFSMCommandResponse, + ] + execute_expert_command: _grpc.UnaryUnaryMultiCallable[ + _controller_pb2.ExecuteExpertCommandRequest, + _controller_pb2.ExecuteExpertCommandResponse, + ] + include: _grpc.UnaryUnaryMultiCallable[ + _controller_pb2.IncludeRequest, _controller_pb2.IncludeResponse + ] + exclude: _grpc.UnaryUnaryMultiCallable[ + _controller_pb2.ExcludeRequest, _controller_pb2.ExcludeResponse + ] + recompute_status: _grpc.UnaryUnaryMultiCallable[ + _controller_pb2.RecomputeStatusRequest, _controller_pb2.RecomputeStatusResponse + ] + take_control: _grpc.UnaryUnaryMultiCallable[ + _controller_pb2.TakeControlRequest, _controller_pb2.TakeControlResponse + ] + surrender_control: _grpc.UnaryUnaryMultiCallable[ + _controller_pb2.SurrenderControlRequest, + _controller_pb2.SurrenderControlResponse, + ] + who_is_in_charge: _grpc.UnaryUnaryMultiCallable[ + _controller_pb2.WhoIsInChargeRequest, _controller_pb2.WhoIsInChargeResponse + ] + to_error: _grpc.UnaryUnaryMultiCallable[ + _controller_pb2.ToErrorRequest, _controller_pb2.ToErrorResponse + ] + +@_typing.type_check_only +class ControllerAsyncStub(ControllerStub): + def __init__(self, channel: _aio.Channel) -> None: ... + describe: _aio.UnaryUnaryMultiCallable[ + _controller_pb2.DescribeRequest, _controller_pb2.DescribeResponse + ] # type: ignore[assignment] + status: _aio.UnaryUnaryMultiCallable[ + _controller_pb2.StatusRequest, _controller_pb2.StatusResponse + ] # type: ignore[assignment] + describe_fsm: _aio.UnaryUnaryMultiCallable[ + _controller_pb2.DescribeFSMRequest, _controller_pb2.DescribeFSMResponse + ] # type: ignore[assignment] + execute_fsm_command: _aio.UnaryUnaryMultiCallable[ + _controller_pb2.ExecuteFSMCommandRequest, + _controller_pb2.ExecuteFSMCommandResponse, + ] # type: ignore[assignment] + execute_expert_command: _aio.UnaryUnaryMultiCallable[ + _controller_pb2.ExecuteExpertCommandRequest, + _controller_pb2.ExecuteExpertCommandResponse, + ] # type: ignore[assignment] + include: _aio.UnaryUnaryMultiCallable[ + _controller_pb2.IncludeRequest, _controller_pb2.IncludeResponse + ] # type: ignore[assignment] + exclude: _aio.UnaryUnaryMultiCallable[ + _controller_pb2.ExcludeRequest, _controller_pb2.ExcludeResponse + ] # type: ignore[assignment] + recompute_status: _aio.UnaryUnaryMultiCallable[ + _controller_pb2.RecomputeStatusRequest, _controller_pb2.RecomputeStatusResponse + ] # type: ignore[assignment] + take_control: _aio.UnaryUnaryMultiCallable[ + _controller_pb2.TakeControlRequest, _controller_pb2.TakeControlResponse + ] # type: ignore[assignment] + surrender_control: _aio.UnaryUnaryMultiCallable[ + _controller_pb2.SurrenderControlRequest, + _controller_pb2.SurrenderControlResponse, + ] # type: ignore[assignment] + who_is_in_charge: _aio.UnaryUnaryMultiCallable[ + _controller_pb2.WhoIsInChargeRequest, _controller_pb2.WhoIsInChargeResponse + ] # type: ignore[assignment] + to_error: _aio.UnaryUnaryMultiCallable[ + _controller_pb2.ToErrorRequest, _controller_pb2.ToErrorResponse + ] # type: ignore[assignment] + +class ControllerServicer(metaclass=_abc_1.ABCMeta): + @_abc_1.abstractmethod + def describe( + self, + request: _controller_pb2.DescribeRequest, + context: _ServicerContext, + ) -> ( + _controller_pb2.DescribeResponse + | _abc.Awaitable[_controller_pb2.DescribeResponse] + ): ... + @_abc_1.abstractmethod + def status( + self, + request: _controller_pb2.StatusRequest, + context: _ServicerContext, + ) -> ( + _controller_pb2.StatusResponse | _abc.Awaitable[_controller_pb2.StatusResponse] + ): ... + @_abc_1.abstractmethod + def describe_fsm( + self, + request: _controller_pb2.DescribeFSMRequest, + context: _ServicerContext, + ) -> ( + _controller_pb2.DescribeFSMResponse + | _abc.Awaitable[_controller_pb2.DescribeFSMResponse] + ): ... + @_abc_1.abstractmethod + def execute_fsm_command( + self, + request: _controller_pb2.ExecuteFSMCommandRequest, + context: _ServicerContext, + ) -> ( + _controller_pb2.ExecuteFSMCommandResponse + | _abc.Awaitable[_controller_pb2.ExecuteFSMCommandResponse] + ): ... + @_abc_1.abstractmethod + def execute_expert_command( + self, + request: _controller_pb2.ExecuteExpertCommandRequest, + context: _ServicerContext, + ) -> ( + _controller_pb2.ExecuteExpertCommandResponse + | _abc.Awaitable[_controller_pb2.ExecuteExpertCommandResponse] + ): ... + @_abc_1.abstractmethod + def include( + self, + request: _controller_pb2.IncludeRequest, + context: _ServicerContext, + ) -> ( + _controller_pb2.IncludeResponse + | _abc.Awaitable[_controller_pb2.IncludeResponse] + ): ... + @_abc_1.abstractmethod + def exclude( + self, + request: _controller_pb2.ExcludeRequest, + context: _ServicerContext, + ) -> ( + _controller_pb2.ExcludeResponse + | _abc.Awaitable[_controller_pb2.ExcludeResponse] + ): ... + @_abc_1.abstractmethod + def recompute_status( + self, + request: _controller_pb2.RecomputeStatusRequest, + context: _ServicerContext, + ) -> ( + _controller_pb2.RecomputeStatusResponse + | _abc.Awaitable[_controller_pb2.RecomputeStatusResponse] + ): ... + @_abc_1.abstractmethod + def take_control( + self, + request: _controller_pb2.TakeControlRequest, + context: _ServicerContext, + ) -> ( + _controller_pb2.TakeControlResponse + | _abc.Awaitable[_controller_pb2.TakeControlResponse] + ): ... + @_abc_1.abstractmethod + def surrender_control( + self, + request: _controller_pb2.SurrenderControlRequest, + context: _ServicerContext, + ) -> ( + _controller_pb2.SurrenderControlResponse + | _abc.Awaitable[_controller_pb2.SurrenderControlResponse] + ): ... + @_abc_1.abstractmethod + def who_is_in_charge( + self, + request: _controller_pb2.WhoIsInChargeRequest, + context: _ServicerContext, + ) -> ( + _controller_pb2.WhoIsInChargeResponse + | _abc.Awaitable[_controller_pb2.WhoIsInChargeResponse] + ): ... + @_abc_1.abstractmethod + def to_error( + self, + request: _controller_pb2.ToErrorRequest, + context: _ServicerContext, + ) -> ( + _controller_pb2.ToErrorResponse + | _abc.Awaitable[_controller_pb2.ToErrorResponse] + ): ... + +def add_ControllerServicer_to_server( + servicer: ControllerServicer, server: _grpc.Server | _aio.Server +) -> None: ... diff --git a/src/druncschema/description_pb2_grpc.pyi b/src/druncschema/description_pb2_grpc.pyi new file mode 100644 index 0000000..e62dfb0 --- /dev/null +++ b/src/druncschema/description_pb2_grpc.pyi @@ -0,0 +1,21 @@ +"""@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" + +import abc as _abc_1 +import typing as _typing +from collections import abc as _abc + +import grpc as _grpc +from grpc import aio as _aio + +_T = _typing.TypeVar("_T") + +class _MaybeAsyncIterator( + _abc.AsyncIterator[_T], _abc.Iterator[_T], metaclass=_abc_1.ABCMeta +): ... +class _ServicerContext(_grpc.ServicerContext, _aio.ServicerContext): # type: ignore[misc, type-arg] + ... + +GRPC_GENERATED_VERSION: str +GRPC_VERSION: str diff --git a/src/druncschema/generic_pb2_grpc.pyi b/src/druncschema/generic_pb2_grpc.pyi new file mode 100644 index 0000000..e62dfb0 --- /dev/null +++ b/src/druncschema/generic_pb2_grpc.pyi @@ -0,0 +1,21 @@ +"""@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" + +import abc as _abc_1 +import typing as _typing +from collections import abc as _abc + +import grpc as _grpc +from grpc import aio as _aio + +_T = _typing.TypeVar("_T") + +class _MaybeAsyncIterator( + _abc.AsyncIterator[_T], _abc.Iterator[_T], metaclass=_abc_1.ABCMeta +): ... +class _ServicerContext(_grpc.ServicerContext, _aio.ServicerContext): # type: ignore[misc, type-arg] + ... + +GRPC_GENERATED_VERSION: str +GRPC_VERSION: str diff --git a/src/druncschema/opmon/FSM_pb2_grpc.pyi b/src/druncschema/opmon/FSM_pb2_grpc.pyi new file mode 100644 index 0000000..e62dfb0 --- /dev/null +++ b/src/druncschema/opmon/FSM_pb2_grpc.pyi @@ -0,0 +1,21 @@ +"""@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" + +import abc as _abc_1 +import typing as _typing +from collections import abc as _abc + +import grpc as _grpc +from grpc import aio as _aio + +_T = _typing.TypeVar("_T") + +class _MaybeAsyncIterator( + _abc.AsyncIterator[_T], _abc.Iterator[_T], metaclass=_abc_1.ABCMeta +): ... +class _ServicerContext(_grpc.ServicerContext, _aio.ServicerContext): # type: ignore[misc, type-arg] + ... + +GRPC_GENERATED_VERSION: str +GRPC_VERSION: str diff --git a/src/druncschema/opmon/generic_pb2_grpc.pyi b/src/druncschema/opmon/generic_pb2_grpc.pyi new file mode 100644 index 0000000..e62dfb0 --- /dev/null +++ b/src/druncschema/opmon/generic_pb2_grpc.pyi @@ -0,0 +1,21 @@ +"""@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" + +import abc as _abc_1 +import typing as _typing +from collections import abc as _abc + +import grpc as _grpc +from grpc import aio as _aio + +_T = _typing.TypeVar("_T") + +class _MaybeAsyncIterator( + _abc.AsyncIterator[_T], _abc.Iterator[_T], metaclass=_abc_1.ABCMeta +): ... +class _ServicerContext(_grpc.ServicerContext, _aio.ServicerContext): # type: ignore[misc, type-arg] + ... + +GRPC_GENERATED_VERSION: str +GRPC_VERSION: str diff --git a/src/druncschema/opmon/process_manager_pb2_grpc.pyi b/src/druncschema/opmon/process_manager_pb2_grpc.pyi new file mode 100644 index 0000000..e62dfb0 --- /dev/null +++ b/src/druncschema/opmon/process_manager_pb2_grpc.pyi @@ -0,0 +1,21 @@ +"""@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" + +import abc as _abc_1 +import typing as _typing +from collections import abc as _abc + +import grpc as _grpc +from grpc import aio as _aio + +_T = _typing.TypeVar("_T") + +class _MaybeAsyncIterator( + _abc.AsyncIterator[_T], _abc.Iterator[_T], metaclass=_abc_1.ABCMeta +): ... +class _ServicerContext(_grpc.ServicerContext, _aio.ServicerContext): # type: ignore[misc, type-arg] + ... + +GRPC_GENERATED_VERSION: str +GRPC_VERSION: str diff --git a/src/druncschema/process_manager_pb2_grpc.pyi b/src/druncschema/process_manager_pb2_grpc.pyi new file mode 100644 index 0000000..fba6939 --- /dev/null +++ b/src/druncschema/process_manager_pb2_grpc.pyi @@ -0,0 +1,178 @@ +"""@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" + +import abc as _abc_1 +import sys +import typing as _typing +from collections import abc as _abc + +import grpc as _grpc +from grpc import aio as _aio + +from druncschema import description_pb2 as _description_pb2 +from druncschema import generic_pb2 as _generic_pb2 +from druncschema import process_manager_pb2 as _process_manager_pb2 +from druncschema import request_response_pb2 as _request_response_pb2 + +if sys.version_info >= (3, 11): + from typing import Self as _Self +else: + from typing_extensions import Self as _Self + +_T = _typing.TypeVar("_T") + +class _MaybeAsyncIterator( + _abc.AsyncIterator[_T], _abc.Iterator[_T], metaclass=_abc_1.ABCMeta +): ... +class _ServicerContext(_grpc.ServicerContext, _aio.ServicerContext): # type: ignore[misc, type-arg] + ... + +GRPC_GENERATED_VERSION: str +GRPC_VERSION: str + +class ProcessManagerStub: + @_typing.overload + def __new__(cls, channel: _grpc.Channel) -> _Self: ... + @_typing.overload + def __new__(cls, channel: _aio.Channel) -> ProcessManagerAsyncStub: ... + send_msg: _grpc.UnaryUnaryMultiCallable[ + _request_response_pb2.Request, _generic_pb2.OutcomeStatus + ] + describe: _grpc.UnaryUnaryMultiCallable[ + _request_response_pb2.Request, _description_pb2.Description + ] + boot: _grpc.UnaryUnaryMultiCallable[ + _process_manager_pb2.BootRequest, _process_manager_pb2.ProcessInstanceList + ] + terminate: _grpc.UnaryUnaryMultiCallable[ + _request_response_pb2.Request, _process_manager_pb2.ProcessInstanceList + ] + restart: _grpc.UnaryUnaryMultiCallable[ + _process_manager_pb2.ProcessQuery, _process_manager_pb2.ProcessInstanceList + ] + kill: _grpc.UnaryUnaryMultiCallable[ + _process_manager_pb2.ProcessQuery, _process_manager_pb2.ProcessInstanceList + ] + flush: _grpc.UnaryUnaryMultiCallable[ + _process_manager_pb2.ProcessQuery, _process_manager_pb2.ProcessInstanceList + ] + ps: _grpc.UnaryUnaryMultiCallable[ + _process_manager_pb2.ProcessQuery, _process_manager_pb2.ProcessInstanceList + ] + logs: _grpc.UnaryUnaryMultiCallable[ + _process_manager_pb2.LogRequest, _process_manager_pb2.LogLines + ] + +@_typing.type_check_only +class ProcessManagerAsyncStub(ProcessManagerStub): + def __init__(self, channel: _aio.Channel) -> None: ... + send_msg: _aio.UnaryUnaryMultiCallable[ + _request_response_pb2.Request, _generic_pb2.OutcomeStatus + ] # type: ignore[assignment] + describe: _aio.UnaryUnaryMultiCallable[ + _request_response_pb2.Request, _description_pb2.Description + ] # type: ignore[assignment] + boot: _aio.UnaryUnaryMultiCallable[ + _process_manager_pb2.BootRequest, _process_manager_pb2.ProcessInstanceList + ] # type: ignore[assignment] + terminate: _aio.UnaryUnaryMultiCallable[ + _request_response_pb2.Request, _process_manager_pb2.ProcessInstanceList + ] # type: ignore[assignment] + restart: _aio.UnaryUnaryMultiCallable[ + _process_manager_pb2.ProcessQuery, _process_manager_pb2.ProcessInstanceList + ] # type: ignore[assignment] + kill: _aio.UnaryUnaryMultiCallable[ + _process_manager_pb2.ProcessQuery, _process_manager_pb2.ProcessInstanceList + ] # type: ignore[assignment] + flush: _aio.UnaryUnaryMultiCallable[ + _process_manager_pb2.ProcessQuery, _process_manager_pb2.ProcessInstanceList + ] # type: ignore[assignment] + ps: _aio.UnaryUnaryMultiCallable[ + _process_manager_pb2.ProcessQuery, _process_manager_pb2.ProcessInstanceList + ] # type: ignore[assignment] + logs: _aio.UnaryUnaryMultiCallable[ + _process_manager_pb2.LogRequest, _process_manager_pb2.LogLines + ] # type: ignore[assignment] + +class ProcessManagerServicer(metaclass=_abc_1.ABCMeta): + @_abc_1.abstractmethod + def send_msg( + self, + request: _request_response_pb2.Request, + context: _ServicerContext, + ) -> _generic_pb2.OutcomeStatus | _abc.Awaitable[_generic_pb2.OutcomeStatus]: ... + @_abc_1.abstractmethod + def describe( + self, + request: _request_response_pb2.Request, + context: _ServicerContext, + ) -> ( + _description_pb2.Description | _abc.Awaitable[_description_pb2.Description] + ): ... + @_abc_1.abstractmethod + def boot( + self, + request: _process_manager_pb2.BootRequest, + context: _ServicerContext, + ) -> ( + _process_manager_pb2.ProcessInstanceList + | _abc.Awaitable[_process_manager_pb2.ProcessInstanceList] + ): ... + @_abc_1.abstractmethod + def terminate( + self, + request: _request_response_pb2.Request, + context: _ServicerContext, + ) -> ( + _process_manager_pb2.ProcessInstanceList + | _abc.Awaitable[_process_manager_pb2.ProcessInstanceList] + ): ... + @_abc_1.abstractmethod + def restart( + self, + request: _process_manager_pb2.ProcessQuery, + context: _ServicerContext, + ) -> ( + _process_manager_pb2.ProcessInstanceList + | _abc.Awaitable[_process_manager_pb2.ProcessInstanceList] + ): ... + @_abc_1.abstractmethod + def kill( + self, + request: _process_manager_pb2.ProcessQuery, + context: _ServicerContext, + ) -> ( + _process_manager_pb2.ProcessInstanceList + | _abc.Awaitable[_process_manager_pb2.ProcessInstanceList] + ): ... + @_abc_1.abstractmethod + def flush( + self, + request: _process_manager_pb2.ProcessQuery, + context: _ServicerContext, + ) -> ( + _process_manager_pb2.ProcessInstanceList + | _abc.Awaitable[_process_manager_pb2.ProcessInstanceList] + ): ... + @_abc_1.abstractmethod + def ps( + self, + request: _process_manager_pb2.ProcessQuery, + context: _ServicerContext, + ) -> ( + _process_manager_pb2.ProcessInstanceList + | _abc.Awaitable[_process_manager_pb2.ProcessInstanceList] + ): ... + @_abc_1.abstractmethod + def logs( + self, + request: _process_manager_pb2.LogRequest, + context: _ServicerContext, + ) -> ( + _process_manager_pb2.LogLines | _abc.Awaitable[_process_manager_pb2.LogLines] + ): ... + +def add_ProcessManagerServicer_to_server( + servicer: ProcessManagerServicer, server: _grpc.Server | _aio.Server +) -> None: ... diff --git a/src/druncschema/request_response_pb2_grpc.pyi b/src/druncschema/request_response_pb2_grpc.pyi new file mode 100644 index 0000000..e62dfb0 --- /dev/null +++ b/src/druncschema/request_response_pb2_grpc.pyi @@ -0,0 +1,21 @@ +"""@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" + +import abc as _abc_1 +import typing as _typing +from collections import abc as _abc + +import grpc as _grpc +from grpc import aio as _aio + +_T = _typing.TypeVar("_T") + +class _MaybeAsyncIterator( + _abc.AsyncIterator[_T], _abc.Iterator[_T], metaclass=_abc_1.ABCMeta +): ... +class _ServicerContext(_grpc.ServicerContext, _aio.ServicerContext): # type: ignore[misc, type-arg] + ... + +GRPC_GENERATED_VERSION: str +GRPC_VERSION: str diff --git a/src/druncschema/session_manager_pb2_grpc.pyi b/src/druncschema/session_manager_pb2_grpc.pyi new file mode 100644 index 0000000..51227b9 --- /dev/null +++ b/src/druncschema/session_manager_pb2_grpc.pyi @@ -0,0 +1,91 @@ +"""@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" + +import abc as _abc_1 +import sys +import typing as _typing +from collections import abc as _abc + +import grpc as _grpc +from grpc import aio as _aio + +from druncschema import description_pb2 as _description_pb2 +from druncschema import request_response_pb2 as _request_response_pb2 +from druncschema import session_manager_pb2 as _session_manager_pb2 + +if sys.version_info >= (3, 11): + from typing import Self as _Self +else: + from typing_extensions import Self as _Self + +_T = _typing.TypeVar("_T") + +class _MaybeAsyncIterator( + _abc.AsyncIterator[_T], _abc.Iterator[_T], metaclass=_abc_1.ABCMeta +): ... +class _ServicerContext(_grpc.ServicerContext, _aio.ServicerContext): # type: ignore[misc, type-arg] + ... + +GRPC_GENERATED_VERSION: str +GRPC_VERSION: str + +class SessionManagerStub: + @_typing.overload + def __new__(cls, channel: _grpc.Channel) -> _Self: ... + @_typing.overload + def __new__(cls, channel: _aio.Channel) -> SessionManagerAsyncStub: ... + describe: _grpc.UnaryUnaryMultiCallable[ + _request_response_pb2.Request, _description_pb2.Description + ] + list_all_sessions: _grpc.UnaryUnaryMultiCallable[ + _request_response_pb2.Request, _session_manager_pb2.AllActiveSessions + ] + list_all_configs: _grpc.UnaryUnaryMultiCallable[ + _request_response_pb2.Request, _session_manager_pb2.AllConfigKeys + ] + +@_typing.type_check_only +class SessionManagerAsyncStub(SessionManagerStub): + def __init__(self, channel: _aio.Channel) -> None: ... + describe: _aio.UnaryUnaryMultiCallable[ + _request_response_pb2.Request, _description_pb2.Description + ] # type: ignore[assignment] + list_all_sessions: _aio.UnaryUnaryMultiCallable[ + _request_response_pb2.Request, _session_manager_pb2.AllActiveSessions + ] # type: ignore[assignment] + list_all_configs: _aio.UnaryUnaryMultiCallable[ + _request_response_pb2.Request, _session_manager_pb2.AllConfigKeys + ] # type: ignore[assignment] + +class SessionManagerServicer(metaclass=_abc_1.ABCMeta): + @_abc_1.abstractmethod + def describe( + self, + request: _request_response_pb2.Request, + context: _ServicerContext, + ) -> ( + _description_pb2.Description | _abc.Awaitable[_description_pb2.Description] + ): ... + @_abc_1.abstractmethod + def list_all_sessions( + self, + request: _request_response_pb2.Request, + context: _ServicerContext, + ) -> ( + _session_manager_pb2.AllActiveSessions + | _abc.Awaitable[_session_manager_pb2.AllActiveSessions] + ): ... + @_abc_1.abstractmethod + def list_all_configs( + self, + request: _request_response_pb2.Request, + context: _ServicerContext, + ) -> ( + _session_manager_pb2.AllConfigKeys + | _abc.Awaitable[_session_manager_pb2.AllConfigKeys] + ): ... + +def add_SessionManagerServicer_to_server( + servicer: SessionManagerServicer, server: _grpc.Server | _aio.Server +) -> None: ... diff --git a/src/druncschema/token_pb2_grpc.pyi b/src/druncschema/token_pb2_grpc.pyi new file mode 100644 index 0000000..e62dfb0 --- /dev/null +++ b/src/druncschema/token_pb2_grpc.pyi @@ -0,0 +1,21 @@ +"""@generated by mypy-protobuf. Do not edit manually! +isort:skip_file +""" + +import abc as _abc_1 +import typing as _typing +from collections import abc as _abc + +import grpc as _grpc +from grpc import aio as _aio + +_T = _typing.TypeVar("_T") + +class _MaybeAsyncIterator( + _abc.AsyncIterator[_T], _abc.Iterator[_T], metaclass=_abc_1.ABCMeta +): ... +class _ServicerContext(_grpc.ServicerContext, _aio.ServicerContext): # type: ignore[misc, type-arg] + ... + +GRPC_GENERATED_VERSION: str +GRPC_VERSION: str