diff --git a/pyproject.toml b/pyproject.toml index 0fb39c55e..47513f02c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,29 +6,23 @@ authors = [{ name = "Temporal Technologies Inc", email = "sdk@temporal.io" }] requires-python = ">=3.9" readme = "README.md" license = { file = "LICENSE" } -keywords = [ - "temporal", - "workflow", -] +keywords = ["temporal", "workflow"] dependencies = [ - "nexus-rpc==1.1.0", - "protobuf>=3.20,<7.0.0", - "python-dateutil>=2.8.2,<3 ; python_version < '3.11'", - "types-protobuf>=3.20", - "typing-extensions>=4.2.0,<5", + "nexus-rpc==1.1.0", + "protobuf>=3.20,<7.0.0", + "python-dateutil>=2.8.2,<3 ; python_version < '3.11'", + "types-protobuf>=3.20", + "typing-extensions>=4.2.0,<5", ] [project.optional-dependencies] grpc = ["grpcio>=1.48.2,<2"] -opentelemetry = [ - "opentelemetry-api>=1.11.1,<2", - "opentelemetry-sdk>=1.11.1,<2", -] +opentelemetry = ["opentelemetry-api>=1.11.1,<2", "opentelemetry-sdk>=1.11.1,<2"] pydantic = ["pydantic>=2.0.0,<3"] openai-agents = [ - "openai-agents>=0.3,<0.4", - "eval-type-backport>=0.2.2; python_version < '3.10'", - "mcp>=1.9.4, <2; python_version >= '3.10'", + "openai-agents>=0.3,<0.4", + "eval-type-backport>=0.2.2; python_version < '3.10'", + "mcp>=1.9.4, <2; python_version >= '3.10'", ] [project.urls] @@ -39,48 +33,50 @@ Documentation = "https://docs.temporal.io/docs/python" [dependency-groups] dev = [ - "cibuildwheel>=2.22.0,<3", - "grpcio-tools>=1.48.2,<2", - "mypy==1.4.1", - "mypy-protobuf>=3.3.0,<4", - "psutil>=5.9.3,<6", - "pydocstyle>=6.3.0,<7", - "pydoctor>=24.11.1,<25", - "pyright==1.1.403", - "pytest~=7.4", - "pytest-asyncio>=0.21,<0.22", - "pytest-timeout~=2.2", - "ruff>=0.5.0,<0.6", - "toml>=0.10.2,<0.11", - "twine>=4.0.1,<5", - "ruff>=0.5.0,<0.6", - "maturin>=1.8.2", - "pytest-cov>=6.1.1", - "httpx>=0.28.1", - "pytest-pretty>=1.3.0", - "openai-agents[litellm]>=0.3,<0.4" + "cibuildwheel>=2.22.0,<3", + "grpcio-tools>=1.48.2,<2", + "mypy==1.4.1", + "mypy-protobuf>=3.3.0,<4", + "psutil>=5.9.3,<6", + "pydocstyle>=6.3.0,<7", + "pydoctor>=24.11.1,<25", + "pyright==1.1.403", + "pytest~=7.4", + "pytest-asyncio>=0.21,<0.22", + "pytest-timeout~=2.2", + "ruff>=0.5.0,<0.6", + "toml>=0.10.2,<0.11", + "twine>=4.0.1,<5", + "maturin>=1.8.2", + "pytest-cov>=6.1.1", + "httpx>=0.28.1", + "pytest-pretty>=1.3.0", + "openai-agents[litellm]>=0.3,<0.4", ] [tool.poe.tasks] build-develop = "uv run maturin develop --uv" build-develop-with-release = { cmd = "uv run maturin develop --release --uv" } -format = [{cmd = "uv run ruff check --select I --fix"}, {cmd = "uv run ruff format"}, ] +format = [ + { cmd = "uv run ruff check --select I --fix" }, + { cmd = "uv run ruff format" }, +] gen-docs = "uv run scripts/gen_docs.py" gen-protos = "uv run scripts/gen_protos.py" gen-protos-docker = "uv run scripts/gen_protos_docker.py" lint = [ - {cmd = "uv run ruff check --select I"}, - {cmd = "uv run ruff format --check"}, - {ref = "lint-types"}, - {ref = "lint-docs"}, + { cmd = "uv run ruff check --select I" }, + { cmd = "uv run ruff format --check" }, + { ref = "lint-types" }, + { ref = "lint-docs" }, ] bridge-lint = { cmd = "cargo clippy -- -D warnings", cwd = "temporalio/bridge" } # TODO(cretz): Why does pydocstyle complain about @overload missing docs after # https://github.com/PyCQA/pydocstyle/pull/511? lint-docs = "uv run pydocstyle --ignore-decorators=overload" lint-types = [ - { cmd = "uv run pyright"}, - { cmd = "uv run mypy --namespace-packages --check-untyped-defs ."}, + { cmd = "uv run pyright" }, + { cmd = "uv run mypy --namespace-packages --check-untyped-defs ." }, ] run-bench = "uv run python scripts/run_bench.py" test = "uv run pytest" @@ -120,17 +116,18 @@ ignore_missing_imports = true exclude = [ # Ignore generated code 'temporalio/api', - 'temporalio/bridge/proto' + 'temporalio/bridge/proto', ] [tool.pydocstyle] convention = "google" # https://github.com/PyCQA/pydocstyle/issues/363#issuecomment-625563088 -match_dir = "^(?!(docs|scripts|tests|api|proto|\\.)).*" +match_dir = "^(?!(docs|scripts|tests|api|proto|generated|\\.)).*" add_ignore = [ # We like to wrap at a certain number of chars, even long summary sentences. # https://github.com/PyCQA/pydocstyle/issues/184 - "D205", "D415" + "D205", + "D415", ] [tool.pydoctor] @@ -226,9 +223,7 @@ manifest-path = "temporalio/bridge/Cargo.toml" module-name = "temporalio.bridge.temporal_sdk_bridge" python-packages = ["temporalio"] include = ["LICENSE"] -exclude = [ - "temporalio/bridge/target/**/*", -] +exclude = ["temporalio/bridge/target/**/*"] [tool.uv] # Prevent uv commands from building the package by default diff --git a/scripts/gen_bridge_client.py b/scripts/gen_bridge_client.py new file mode 100644 index 000000000..40b9744d0 --- /dev/null +++ b/scripts/gen_bridge_client.py @@ -0,0 +1,266 @@ +import re +from functools import partial +from string import Template + +from google.protobuf.descriptor import ( + FileDescriptor, + MethodDescriptor, + ServiceDescriptor, +) + +import temporalio.api.cloud.cloudservice.v1.service_pb2 as cloud_service +import temporalio.api.operatorservice.v1.service_pb2 as operator_service +import temporalio.api.testservice.v1.service_pb2 as test_service +import temporalio.api.workflowservice.v1.service_pb2 as workflow_service +import temporalio.bridge.proto.health.v1.health_pb2 as health_service + + +def generate_python_services( + file_descriptors: list[FileDescriptor], + output_file: str = "temporalio/bridge/generated/services_generated.py", +): + print("generating python services") + + services_template = Template("""# Generated file. DO NOT EDIT + +from __future__ import annotations + +from datetime import timedelta +from typing import Mapping, Optional, Union, TYPE_CHECKING +import google.protobuf.empty_pb2 + +$service_imports + + +if TYPE_CHECKING: + from temporalio.service import ServiceClient + +$service_defns +""") + + def service_name(s): + return f"import {sanitize_proto_name(s.full_name)[:-len(s.name)-1]}" + + service_imports = [ + service_name(service_descriptor) + for file_descriptor in file_descriptors + for service_descriptor in file_descriptor.services_by_name.values() + ] + + service_defns = [ + generate_python_service(service_descriptor) + for file_descriptor in file_descriptors + for service_descriptor in file_descriptor.services_by_name.values() + ] + + with open(output_file, "w") as f: + f.write( + services_template.substitute( + service_imports="\n".join(service_imports), + service_defns="\n".join(service_defns), + ) + ) + + print(f"successfully generated client at {output_file}") + + +def generate_python_service(service_descriptor: ServiceDescriptor) -> str: + service_template = Template(""" +class $service_name: + def __init__(self, client: ServiceClient): + self.client = client + self.service = "$rpc_service_name" +$method_calls +""") + + sanitized_service_name: str = service_descriptor.name + # The health service doesn't end in "Service" in the proto definition + # this check ensures that the proto descriptor name will match the format in core + if not sanitized_service_name.endswith("Service"): + sanitized_service_name += "Service" + + # remove "Service" and lowercase + rpc_name = sanitized_service_name[:-7].lower() + + # remove any streaming methods b/c we don't support them at the moment + methods = [ + method + for method in service_descriptor.methods + if not method.client_streaming and not method.server_streaming + ] + + method_calls = [ + generate_python_method_call(method) + for method in sorted(methods, key=lambda m: m.name) + ] + + return service_template.substitute( + service_name=sanitized_service_name, + rpc_service_name=pascal_to_snake(rpc_name), + method_calls="\n".join(method_calls), + ) + + +def generate_python_method_call(method_descriptor: MethodDescriptor) -> str: + method_template = Template(""" + async def $method_name( + self, + req: $request_type, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> $response_type: + return await self.client._rpc_call( + rpc="$method_name", + req=req, + service=self.service, + resp_type=$response_type, + retry=retry, + metadata=metadata, + timeout=timeout, + ) +""") + + return method_template.substitute( + method_name=pascal_to_snake(method_descriptor.name), + request_type=sanitize_proto_name(method_descriptor.input_type.full_name), + response_type=sanitize_proto_name(method_descriptor.output_type.full_name), + ) + + +def generate_rust_client_impl( + file_descriptors: list[FileDescriptor], + output_file: str = "temporalio/bridge/src/client_rpc_generated.rs", +): + print("generating bridge rpc calls") + + service_calls = [ + generate_rust_service_call(service_descriptor) + for file_descriptor in file_descriptors + for service_descriptor in file_descriptor.services_by_name.values() + ] + + impl_template = Template("""// Generated file. DO NOT EDIT + +use pyo3::exceptions::PyValueError; +use pyo3::prelude::*; + +use super::{ + client::{rpc_req, rpc_resp, ClientRef, RpcCall}, + rpc_call, +}; + +#[pymethods] +impl ClientRef { +$service_calls +}""") + + with open(output_file, "w") as f: + f.write(impl_template.substitute(service_calls="\n".join(service_calls))) + + print(f"successfully generated client at {output_file}") + + +def generate_rust_service_call(service_descriptor: ServiceDescriptor) -> str: + print(f"generating rpc call wrapper for {service_descriptor.full_name}") + + call_template = Template(""" +fn call_${service_name}<'p>( + &self, + py: Python<'p>, + call: RpcCall, + ) -> PyResult> { + use temporal_client::${descriptor_name}; + let mut retry_client = self.retry_client.clone(); + self.runtime.future_into_py(py, async move { + let bytes = match call.rpc.as_str() { +$match_arms + _ => { + return Err(PyValueError::new_err(format!( + "Unknown RPC call {}", + call.rpc + ))) + } + }?; + Ok(bytes) + }) + }""") + + sanitized_service_name: str = service_descriptor.name + # The health service doesn't end in "Service" in the proto definition + # this check ensures that the proto descriptor name will match the format in core + if not sanitized_service_name.endswith("Service"): + sanitized_service_name += "Service" + + # remove any streaming methods b/c we don't support them at the moment + methods = [ + method + for method in service_descriptor.methods + if not method.client_streaming and not method.server_streaming + ] + + match_arms = [ + generate_rust_match_arm(sanitized_service_name, method) + for method in sorted(methods, key=lambda m: m.name) + ] + + return call_template.substitute( + service_name=pascal_to_snake(sanitized_service_name), + descriptor_name=sanitized_service_name, + match_arms="\n".join(match_arms), + ) + + +def generate_rust_match_arm(trait_name: str, method: MethodDescriptor) -> str: + match_template = Template("""\ + "$method_name" => { + rpc_call!(retry_client, call, $trait_name, $method_name) + }""") + + return match_template.substitute( + method_name=pascal_to_snake(method.name), trait_name=trait_name + ) + + +def pascal_to_snake(input: str) -> str: + return re.sub(r"([a-z0-9])([A-Z])", r"\1_\2", input).lower() + + +sanitize_import_fixes = [ + partial(re.compile(r"temporal\.api\.").sub, r"temporalio.api."), + partial( + re.compile(r"temporal\.grpc.health\.").sub, r"temporalio.bridge.proto.health." + ), + partial( + re.compile(r"google\.protobuf\.Empty").sub, r"google.protobuf.empty_pb2.Empty" + ), +] + + +def sanitize_proto_name(input: str) -> str: + content = input + for fix in sanitize_import_fixes: + content = fix(content) + return content + + +if __name__ == "__main__": + generate_rust_client_impl( + [ + workflow_service.DESCRIPTOR, + operator_service.DESCRIPTOR, + cloud_service.DESCRIPTOR, + test_service.DESCRIPTOR, + health_service.DESCRIPTOR, + ] + ) + + generate_python_services( + [ + workflow_service.DESCRIPTOR, + operator_service.DESCRIPTOR, + cloud_service.DESCRIPTOR, + test_service.DESCRIPTOR, + health_service.DESCRIPTOR, + ] + ) diff --git a/scripts/gen_protos_docker.py b/scripts/gen_protos_docker.py index 099c56a2d..e354cc646 100644 --- a/scripts/gen_protos_docker.py +++ b/scripts/gen_protos_docker.py @@ -30,9 +30,21 @@ ], check=True, ) -subprocess.run(["uv", "run", "poe", "format"], check=True) subprocess.run( ["uv", "run", os.path.join(os.getcwd(), "scripts", "gen_payload_visitor.py")], check=True, ) + +subprocess.run( + ["uv", "run", os.path.join(os.getcwd(), "scripts", "gen_bridge_client.py")], + check=True, +) + +subprocess.run(["uv", "run", "poe", "format"], check=True) + +subprocess.run( + ["cargo", "fmt"], + check=True, + cwd=os.path.join(os.getcwd(), "temporalio", "bridge"), +) diff --git a/temporalio/bridge/Cargo.lock b/temporalio/bridge/Cargo.lock index 740f9a547..b40d5fc72 100644 --- a/temporalio/bridge/Cargo.lock +++ b/temporalio/bridge/Cargo.lock @@ -1713,6 +1713,7 @@ checksum = "8970a78afe0628a3e3430376fc5fd76b6b45c4d43360ffd6cdd40bdde72b682a" dependencies = [ "anyhow", "indoc", + "inventory", "libc", "memoffset", "once_cell", diff --git a/temporalio/bridge/Cargo.toml b/temporalio/bridge/Cargo.toml index 70a3c5820..d1aaabb53 100644 --- a/temporalio/bridge/Cargo.toml +++ b/temporalio/bridge/Cargo.toml @@ -24,6 +24,7 @@ pyo3 = { version = "0.25", features = [ "extension-module", "abi3-py39", "anyhow", + "multiple-pymethods", ] } pyo3-async-runtimes = { version = "0.25", features = ["tokio-runtime"] } pythonize = "0.25" diff --git a/temporalio/bridge/generated/services_generated.py b/temporalio/bridge/generated/services_generated.py new file mode 100644 index 000000000..e0841d382 --- /dev/null +++ b/temporalio/bridge/generated/services_generated.py @@ -0,0 +1,2888 @@ +# Generated file. DO NOT EDIT + +from __future__ import annotations + +from datetime import timedelta +from typing import TYPE_CHECKING, Mapping, Optional, Union + +import google.protobuf.empty_pb2 + +import temporalio.api.cloud.cloudservice.v1 +import temporalio.api.operatorservice.v1 +import temporalio.api.testservice.v1 +import temporalio.api.workflowservice.v1 +import temporalio.bridge.proto.health.v1 + +if TYPE_CHECKING: + from temporalio.service import ServiceClient + + +class WorkflowService: + def __init__(self, client: ServiceClient): + self.client = client + self.service = "workflow" + + async def count_workflow_executions( + self, + req: temporalio.api.workflowservice.v1.CountWorkflowExecutionsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.CountWorkflowExecutionsResponse: + return await self.client._rpc_call( + rpc="count_workflow_executions", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.CountWorkflowExecutionsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def create_schedule( + self, + req: temporalio.api.workflowservice.v1.CreateScheduleRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.CreateScheduleResponse: + return await self.client._rpc_call( + rpc="create_schedule", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.CreateScheduleResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def create_workflow_rule( + self, + req: temporalio.api.workflowservice.v1.CreateWorkflowRuleRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.CreateWorkflowRuleResponse: + return await self.client._rpc_call( + rpc="create_workflow_rule", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.CreateWorkflowRuleResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_schedule( + self, + req: temporalio.api.workflowservice.v1.DeleteScheduleRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.DeleteScheduleResponse: + return await self.client._rpc_call( + rpc="delete_schedule", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.DeleteScheduleResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_worker_deployment( + self, + req: temporalio.api.workflowservice.v1.DeleteWorkerDeploymentRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.DeleteWorkerDeploymentResponse: + return await self.client._rpc_call( + rpc="delete_worker_deployment", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.DeleteWorkerDeploymentResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_worker_deployment_version( + self, + req: temporalio.api.workflowservice.v1.DeleteWorkerDeploymentVersionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.DeleteWorkerDeploymentVersionResponse: + return await self.client._rpc_call( + rpc="delete_worker_deployment_version", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.DeleteWorkerDeploymentVersionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_workflow_execution( + self, + req: temporalio.api.workflowservice.v1.DeleteWorkflowExecutionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.DeleteWorkflowExecutionResponse: + return await self.client._rpc_call( + rpc="delete_workflow_execution", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.DeleteWorkflowExecutionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_workflow_rule( + self, + req: temporalio.api.workflowservice.v1.DeleteWorkflowRuleRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.DeleteWorkflowRuleResponse: + return await self.client._rpc_call( + rpc="delete_workflow_rule", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.DeleteWorkflowRuleResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def deprecate_namespace( + self, + req: temporalio.api.workflowservice.v1.DeprecateNamespaceRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.DeprecateNamespaceResponse: + return await self.client._rpc_call( + rpc="deprecate_namespace", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.DeprecateNamespaceResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def describe_batch_operation( + self, + req: temporalio.api.workflowservice.v1.DescribeBatchOperationRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.DescribeBatchOperationResponse: + return await self.client._rpc_call( + rpc="describe_batch_operation", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.DescribeBatchOperationResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def describe_deployment( + self, + req: temporalio.api.workflowservice.v1.DescribeDeploymentRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.DescribeDeploymentResponse: + return await self.client._rpc_call( + rpc="describe_deployment", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.DescribeDeploymentResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def describe_namespace( + self, + req: temporalio.api.workflowservice.v1.DescribeNamespaceRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.DescribeNamespaceResponse: + return await self.client._rpc_call( + rpc="describe_namespace", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.DescribeNamespaceResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def describe_schedule( + self, + req: temporalio.api.workflowservice.v1.DescribeScheduleRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.DescribeScheduleResponse: + return await self.client._rpc_call( + rpc="describe_schedule", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.DescribeScheduleResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def describe_task_queue( + self, + req: temporalio.api.workflowservice.v1.DescribeTaskQueueRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.DescribeTaskQueueResponse: + return await self.client._rpc_call( + rpc="describe_task_queue", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.DescribeTaskQueueResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def describe_worker_deployment( + self, + req: temporalio.api.workflowservice.v1.DescribeWorkerDeploymentRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.DescribeWorkerDeploymentResponse: + return await self.client._rpc_call( + rpc="describe_worker_deployment", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.DescribeWorkerDeploymentResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def describe_worker_deployment_version( + self, + req: temporalio.api.workflowservice.v1.DescribeWorkerDeploymentVersionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.DescribeWorkerDeploymentVersionResponse: + return await self.client._rpc_call( + rpc="describe_worker_deployment_version", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.DescribeWorkerDeploymentVersionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def describe_workflow_execution( + self, + req: temporalio.api.workflowservice.v1.DescribeWorkflowExecutionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.DescribeWorkflowExecutionResponse: + return await self.client._rpc_call( + rpc="describe_workflow_execution", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.DescribeWorkflowExecutionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def describe_workflow_rule( + self, + req: temporalio.api.workflowservice.v1.DescribeWorkflowRuleRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.DescribeWorkflowRuleResponse: + return await self.client._rpc_call( + rpc="describe_workflow_rule", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.DescribeWorkflowRuleResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def execute_multi_operation( + self, + req: temporalio.api.workflowservice.v1.ExecuteMultiOperationRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ExecuteMultiOperationResponse: + return await self.client._rpc_call( + rpc="execute_multi_operation", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ExecuteMultiOperationResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def fetch_worker_config( + self, + req: temporalio.api.workflowservice.v1.FetchWorkerConfigRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.FetchWorkerConfigResponse: + return await self.client._rpc_call( + rpc="fetch_worker_config", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.FetchWorkerConfigResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_cluster_info( + self, + req: temporalio.api.workflowservice.v1.GetClusterInfoRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.GetClusterInfoResponse: + return await self.client._rpc_call( + rpc="get_cluster_info", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.GetClusterInfoResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_current_deployment( + self, + req: temporalio.api.workflowservice.v1.GetCurrentDeploymentRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.GetCurrentDeploymentResponse: + return await self.client._rpc_call( + rpc="get_current_deployment", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.GetCurrentDeploymentResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_deployment_reachability( + self, + req: temporalio.api.workflowservice.v1.GetDeploymentReachabilityRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.GetDeploymentReachabilityResponse: + return await self.client._rpc_call( + rpc="get_deployment_reachability", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.GetDeploymentReachabilityResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_search_attributes( + self, + req: temporalio.api.workflowservice.v1.GetSearchAttributesRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.GetSearchAttributesResponse: + return await self.client._rpc_call( + rpc="get_search_attributes", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.GetSearchAttributesResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_system_info( + self, + req: temporalio.api.workflowservice.v1.GetSystemInfoRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.GetSystemInfoResponse: + return await self.client._rpc_call( + rpc="get_system_info", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.GetSystemInfoResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_worker_build_id_compatibility( + self, + req: temporalio.api.workflowservice.v1.GetWorkerBuildIdCompatibilityRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.GetWorkerBuildIdCompatibilityResponse: + return await self.client._rpc_call( + rpc="get_worker_build_id_compatibility", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.GetWorkerBuildIdCompatibilityResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_worker_task_reachability( + self, + req: temporalio.api.workflowservice.v1.GetWorkerTaskReachabilityRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.GetWorkerTaskReachabilityResponse: + return await self.client._rpc_call( + rpc="get_worker_task_reachability", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.GetWorkerTaskReachabilityResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_worker_versioning_rules( + self, + req: temporalio.api.workflowservice.v1.GetWorkerVersioningRulesRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.GetWorkerVersioningRulesResponse: + return await self.client._rpc_call( + rpc="get_worker_versioning_rules", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.GetWorkerVersioningRulesResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_workflow_execution_history( + self, + req: temporalio.api.workflowservice.v1.GetWorkflowExecutionHistoryRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.GetWorkflowExecutionHistoryResponse: + return await self.client._rpc_call( + rpc="get_workflow_execution_history", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.GetWorkflowExecutionHistoryResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_workflow_execution_history_reverse( + self, + req: temporalio.api.workflowservice.v1.GetWorkflowExecutionHistoryReverseRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.GetWorkflowExecutionHistoryReverseResponse: + return await self.client._rpc_call( + rpc="get_workflow_execution_history_reverse", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.GetWorkflowExecutionHistoryReverseResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_archived_workflow_executions( + self, + req: temporalio.api.workflowservice.v1.ListArchivedWorkflowExecutionsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ListArchivedWorkflowExecutionsResponse: + return await self.client._rpc_call( + rpc="list_archived_workflow_executions", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ListArchivedWorkflowExecutionsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_batch_operations( + self, + req: temporalio.api.workflowservice.v1.ListBatchOperationsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ListBatchOperationsResponse: + return await self.client._rpc_call( + rpc="list_batch_operations", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ListBatchOperationsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_closed_workflow_executions( + self, + req: temporalio.api.workflowservice.v1.ListClosedWorkflowExecutionsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ListClosedWorkflowExecutionsResponse: + return await self.client._rpc_call( + rpc="list_closed_workflow_executions", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ListClosedWorkflowExecutionsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_deployments( + self, + req: temporalio.api.workflowservice.v1.ListDeploymentsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ListDeploymentsResponse: + return await self.client._rpc_call( + rpc="list_deployments", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ListDeploymentsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_namespaces( + self, + req: temporalio.api.workflowservice.v1.ListNamespacesRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ListNamespacesResponse: + return await self.client._rpc_call( + rpc="list_namespaces", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ListNamespacesResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_open_workflow_executions( + self, + req: temporalio.api.workflowservice.v1.ListOpenWorkflowExecutionsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ListOpenWorkflowExecutionsResponse: + return await self.client._rpc_call( + rpc="list_open_workflow_executions", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ListOpenWorkflowExecutionsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_schedule_matching_times( + self, + req: temporalio.api.workflowservice.v1.ListScheduleMatchingTimesRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ListScheduleMatchingTimesResponse: + return await self.client._rpc_call( + rpc="list_schedule_matching_times", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ListScheduleMatchingTimesResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_schedules( + self, + req: temporalio.api.workflowservice.v1.ListSchedulesRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ListSchedulesResponse: + return await self.client._rpc_call( + rpc="list_schedules", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ListSchedulesResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_task_queue_partitions( + self, + req: temporalio.api.workflowservice.v1.ListTaskQueuePartitionsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ListTaskQueuePartitionsResponse: + return await self.client._rpc_call( + rpc="list_task_queue_partitions", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ListTaskQueuePartitionsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_worker_deployments( + self, + req: temporalio.api.workflowservice.v1.ListWorkerDeploymentsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ListWorkerDeploymentsResponse: + return await self.client._rpc_call( + rpc="list_worker_deployments", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ListWorkerDeploymentsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_workers( + self, + req: temporalio.api.workflowservice.v1.ListWorkersRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ListWorkersResponse: + return await self.client._rpc_call( + rpc="list_workers", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ListWorkersResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_workflow_executions( + self, + req: temporalio.api.workflowservice.v1.ListWorkflowExecutionsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ListWorkflowExecutionsResponse: + return await self.client._rpc_call( + rpc="list_workflow_executions", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ListWorkflowExecutionsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_workflow_rules( + self, + req: temporalio.api.workflowservice.v1.ListWorkflowRulesRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ListWorkflowRulesResponse: + return await self.client._rpc_call( + rpc="list_workflow_rules", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ListWorkflowRulesResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def patch_schedule( + self, + req: temporalio.api.workflowservice.v1.PatchScheduleRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.PatchScheduleResponse: + return await self.client._rpc_call( + rpc="patch_schedule", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.PatchScheduleResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def pause_activity( + self, + req: temporalio.api.workflowservice.v1.PauseActivityRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.PauseActivityResponse: + return await self.client._rpc_call( + rpc="pause_activity", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.PauseActivityResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def poll_activity_task_queue( + self, + req: temporalio.api.workflowservice.v1.PollActivityTaskQueueRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.PollActivityTaskQueueResponse: + return await self.client._rpc_call( + rpc="poll_activity_task_queue", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.PollActivityTaskQueueResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def poll_nexus_task_queue( + self, + req: temporalio.api.workflowservice.v1.PollNexusTaskQueueRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.PollNexusTaskQueueResponse: + return await self.client._rpc_call( + rpc="poll_nexus_task_queue", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.PollNexusTaskQueueResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def poll_workflow_execution_update( + self, + req: temporalio.api.workflowservice.v1.PollWorkflowExecutionUpdateRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.PollWorkflowExecutionUpdateResponse: + return await self.client._rpc_call( + rpc="poll_workflow_execution_update", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.PollWorkflowExecutionUpdateResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def poll_workflow_task_queue( + self, + req: temporalio.api.workflowservice.v1.PollWorkflowTaskQueueRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.PollWorkflowTaskQueueResponse: + return await self.client._rpc_call( + rpc="poll_workflow_task_queue", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.PollWorkflowTaskQueueResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def query_workflow( + self, + req: temporalio.api.workflowservice.v1.QueryWorkflowRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.QueryWorkflowResponse: + return await self.client._rpc_call( + rpc="query_workflow", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.QueryWorkflowResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def record_activity_task_heartbeat( + self, + req: temporalio.api.workflowservice.v1.RecordActivityTaskHeartbeatRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RecordActivityTaskHeartbeatResponse: + return await self.client._rpc_call( + rpc="record_activity_task_heartbeat", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RecordActivityTaskHeartbeatResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def record_activity_task_heartbeat_by_id( + self, + req: temporalio.api.workflowservice.v1.RecordActivityTaskHeartbeatByIdRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RecordActivityTaskHeartbeatByIdResponse: + return await self.client._rpc_call( + rpc="record_activity_task_heartbeat_by_id", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RecordActivityTaskHeartbeatByIdResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def record_worker_heartbeat( + self, + req: temporalio.api.workflowservice.v1.RecordWorkerHeartbeatRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RecordWorkerHeartbeatResponse: + return await self.client._rpc_call( + rpc="record_worker_heartbeat", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RecordWorkerHeartbeatResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def register_namespace( + self, + req: temporalio.api.workflowservice.v1.RegisterNamespaceRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RegisterNamespaceResponse: + return await self.client._rpc_call( + rpc="register_namespace", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RegisterNamespaceResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def request_cancel_workflow_execution( + self, + req: temporalio.api.workflowservice.v1.RequestCancelWorkflowExecutionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RequestCancelWorkflowExecutionResponse: + return await self.client._rpc_call( + rpc="request_cancel_workflow_execution", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RequestCancelWorkflowExecutionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def reset_activity( + self, + req: temporalio.api.workflowservice.v1.ResetActivityRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ResetActivityResponse: + return await self.client._rpc_call( + rpc="reset_activity", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ResetActivityResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def reset_sticky_task_queue( + self, + req: temporalio.api.workflowservice.v1.ResetStickyTaskQueueRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ResetStickyTaskQueueResponse: + return await self.client._rpc_call( + rpc="reset_sticky_task_queue", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ResetStickyTaskQueueResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def reset_workflow_execution( + self, + req: temporalio.api.workflowservice.v1.ResetWorkflowExecutionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ResetWorkflowExecutionResponse: + return await self.client._rpc_call( + rpc="reset_workflow_execution", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ResetWorkflowExecutionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def respond_activity_task_canceled( + self, + req: temporalio.api.workflowservice.v1.RespondActivityTaskCanceledRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RespondActivityTaskCanceledResponse: + return await self.client._rpc_call( + rpc="respond_activity_task_canceled", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RespondActivityTaskCanceledResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def respond_activity_task_canceled_by_id( + self, + req: temporalio.api.workflowservice.v1.RespondActivityTaskCanceledByIdRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RespondActivityTaskCanceledByIdResponse: + return await self.client._rpc_call( + rpc="respond_activity_task_canceled_by_id", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RespondActivityTaskCanceledByIdResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def respond_activity_task_completed( + self, + req: temporalio.api.workflowservice.v1.RespondActivityTaskCompletedRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RespondActivityTaskCompletedResponse: + return await self.client._rpc_call( + rpc="respond_activity_task_completed", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RespondActivityTaskCompletedResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def respond_activity_task_completed_by_id( + self, + req: temporalio.api.workflowservice.v1.RespondActivityTaskCompletedByIdRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RespondActivityTaskCompletedByIdResponse: + return await self.client._rpc_call( + rpc="respond_activity_task_completed_by_id", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RespondActivityTaskCompletedByIdResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def respond_activity_task_failed( + self, + req: temporalio.api.workflowservice.v1.RespondActivityTaskFailedRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RespondActivityTaskFailedResponse: + return await self.client._rpc_call( + rpc="respond_activity_task_failed", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RespondActivityTaskFailedResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def respond_activity_task_failed_by_id( + self, + req: temporalio.api.workflowservice.v1.RespondActivityTaskFailedByIdRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RespondActivityTaskFailedByIdResponse: + return await self.client._rpc_call( + rpc="respond_activity_task_failed_by_id", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RespondActivityTaskFailedByIdResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def respond_nexus_task_completed( + self, + req: temporalio.api.workflowservice.v1.RespondNexusTaskCompletedRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RespondNexusTaskCompletedResponse: + return await self.client._rpc_call( + rpc="respond_nexus_task_completed", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RespondNexusTaskCompletedResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def respond_nexus_task_failed( + self, + req: temporalio.api.workflowservice.v1.RespondNexusTaskFailedRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RespondNexusTaskFailedResponse: + return await self.client._rpc_call( + rpc="respond_nexus_task_failed", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RespondNexusTaskFailedResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def respond_query_task_completed( + self, + req: temporalio.api.workflowservice.v1.RespondQueryTaskCompletedRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RespondQueryTaskCompletedResponse: + return await self.client._rpc_call( + rpc="respond_query_task_completed", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RespondQueryTaskCompletedResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def respond_workflow_task_completed( + self, + req: temporalio.api.workflowservice.v1.RespondWorkflowTaskCompletedRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RespondWorkflowTaskCompletedResponse: + return await self.client._rpc_call( + rpc="respond_workflow_task_completed", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RespondWorkflowTaskCompletedResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def respond_workflow_task_failed( + self, + req: temporalio.api.workflowservice.v1.RespondWorkflowTaskFailedRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.RespondWorkflowTaskFailedResponse: + return await self.client._rpc_call( + rpc="respond_workflow_task_failed", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.RespondWorkflowTaskFailedResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def scan_workflow_executions( + self, + req: temporalio.api.workflowservice.v1.ScanWorkflowExecutionsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ScanWorkflowExecutionsResponse: + return await self.client._rpc_call( + rpc="scan_workflow_executions", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ScanWorkflowExecutionsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def set_current_deployment( + self, + req: temporalio.api.workflowservice.v1.SetCurrentDeploymentRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.SetCurrentDeploymentResponse: + return await self.client._rpc_call( + rpc="set_current_deployment", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.SetCurrentDeploymentResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def set_worker_deployment_current_version( + self, + req: temporalio.api.workflowservice.v1.SetWorkerDeploymentCurrentVersionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.SetWorkerDeploymentCurrentVersionResponse: + return await self.client._rpc_call( + rpc="set_worker_deployment_current_version", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.SetWorkerDeploymentCurrentVersionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def set_worker_deployment_ramping_version( + self, + req: temporalio.api.workflowservice.v1.SetWorkerDeploymentRampingVersionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.SetWorkerDeploymentRampingVersionResponse: + return await self.client._rpc_call( + rpc="set_worker_deployment_ramping_version", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.SetWorkerDeploymentRampingVersionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def shutdown_worker( + self, + req: temporalio.api.workflowservice.v1.ShutdownWorkerRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.ShutdownWorkerResponse: + return await self.client._rpc_call( + rpc="shutdown_worker", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.ShutdownWorkerResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def signal_with_start_workflow_execution( + self, + req: temporalio.api.workflowservice.v1.SignalWithStartWorkflowExecutionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.SignalWithStartWorkflowExecutionResponse: + return await self.client._rpc_call( + rpc="signal_with_start_workflow_execution", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.SignalWithStartWorkflowExecutionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def signal_workflow_execution( + self, + req: temporalio.api.workflowservice.v1.SignalWorkflowExecutionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.SignalWorkflowExecutionResponse: + return await self.client._rpc_call( + rpc="signal_workflow_execution", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.SignalWorkflowExecutionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def start_batch_operation( + self, + req: temporalio.api.workflowservice.v1.StartBatchOperationRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.StartBatchOperationResponse: + return await self.client._rpc_call( + rpc="start_batch_operation", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.StartBatchOperationResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def start_workflow_execution( + self, + req: temporalio.api.workflowservice.v1.StartWorkflowExecutionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.StartWorkflowExecutionResponse: + return await self.client._rpc_call( + rpc="start_workflow_execution", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.StartWorkflowExecutionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def stop_batch_operation( + self, + req: temporalio.api.workflowservice.v1.StopBatchOperationRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.StopBatchOperationResponse: + return await self.client._rpc_call( + rpc="stop_batch_operation", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.StopBatchOperationResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def terminate_workflow_execution( + self, + req: temporalio.api.workflowservice.v1.TerminateWorkflowExecutionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.TerminateWorkflowExecutionResponse: + return await self.client._rpc_call( + rpc="terminate_workflow_execution", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.TerminateWorkflowExecutionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def trigger_workflow_rule( + self, + req: temporalio.api.workflowservice.v1.TriggerWorkflowRuleRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.TriggerWorkflowRuleResponse: + return await self.client._rpc_call( + rpc="trigger_workflow_rule", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.TriggerWorkflowRuleResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def unpause_activity( + self, + req: temporalio.api.workflowservice.v1.UnpauseActivityRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.UnpauseActivityResponse: + return await self.client._rpc_call( + rpc="unpause_activity", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.UnpauseActivityResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_activity_options( + self, + req: temporalio.api.workflowservice.v1.UpdateActivityOptionsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.UpdateActivityOptionsResponse: + return await self.client._rpc_call( + rpc="update_activity_options", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.UpdateActivityOptionsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_namespace( + self, + req: temporalio.api.workflowservice.v1.UpdateNamespaceRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.UpdateNamespaceResponse: + return await self.client._rpc_call( + rpc="update_namespace", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.UpdateNamespaceResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_schedule( + self, + req: temporalio.api.workflowservice.v1.UpdateScheduleRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.UpdateScheduleResponse: + return await self.client._rpc_call( + rpc="update_schedule", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.UpdateScheduleResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_task_queue_config( + self, + req: temporalio.api.workflowservice.v1.UpdateTaskQueueConfigRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.UpdateTaskQueueConfigResponse: + return await self.client._rpc_call( + rpc="update_task_queue_config", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.UpdateTaskQueueConfigResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_worker_build_id_compatibility( + self, + req: temporalio.api.workflowservice.v1.UpdateWorkerBuildIdCompatibilityRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.UpdateWorkerBuildIdCompatibilityResponse: + return await self.client._rpc_call( + rpc="update_worker_build_id_compatibility", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.UpdateWorkerBuildIdCompatibilityResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_worker_config( + self, + req: temporalio.api.workflowservice.v1.UpdateWorkerConfigRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.UpdateWorkerConfigResponse: + return await self.client._rpc_call( + rpc="update_worker_config", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.UpdateWorkerConfigResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_worker_deployment_version_metadata( + self, + req: temporalio.api.workflowservice.v1.UpdateWorkerDeploymentVersionMetadataRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> ( + temporalio.api.workflowservice.v1.UpdateWorkerDeploymentVersionMetadataResponse + ): + return await self.client._rpc_call( + rpc="update_worker_deployment_version_metadata", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.UpdateWorkerDeploymentVersionMetadataResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_worker_versioning_rules( + self, + req: temporalio.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.UpdateWorkerVersioningRulesResponse: + return await self.client._rpc_call( + rpc="update_worker_versioning_rules", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.UpdateWorkerVersioningRulesResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_workflow_execution( + self, + req: temporalio.api.workflowservice.v1.UpdateWorkflowExecutionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.UpdateWorkflowExecutionResponse: + return await self.client._rpc_call( + rpc="update_workflow_execution", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.UpdateWorkflowExecutionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_workflow_execution_options( + self, + req: temporalio.api.workflowservice.v1.UpdateWorkflowExecutionOptionsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.workflowservice.v1.UpdateWorkflowExecutionOptionsResponse: + return await self.client._rpc_call( + rpc="update_workflow_execution_options", + req=req, + service=self.service, + resp_type=temporalio.api.workflowservice.v1.UpdateWorkflowExecutionOptionsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + +class OperatorService: + def __init__(self, client: ServiceClient): + self.client = client + self.service = "operator" + + async def add_or_update_remote_cluster( + self, + req: temporalio.api.operatorservice.v1.AddOrUpdateRemoteClusterRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.operatorservice.v1.AddOrUpdateRemoteClusterResponse: + return await self.client._rpc_call( + rpc="add_or_update_remote_cluster", + req=req, + service=self.service, + resp_type=temporalio.api.operatorservice.v1.AddOrUpdateRemoteClusterResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def add_search_attributes( + self, + req: temporalio.api.operatorservice.v1.AddSearchAttributesRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.operatorservice.v1.AddSearchAttributesResponse: + return await self.client._rpc_call( + rpc="add_search_attributes", + req=req, + service=self.service, + resp_type=temporalio.api.operatorservice.v1.AddSearchAttributesResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def create_nexus_endpoint( + self, + req: temporalio.api.operatorservice.v1.CreateNexusEndpointRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.operatorservice.v1.CreateNexusEndpointResponse: + return await self.client._rpc_call( + rpc="create_nexus_endpoint", + req=req, + service=self.service, + resp_type=temporalio.api.operatorservice.v1.CreateNexusEndpointResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_namespace( + self, + req: temporalio.api.operatorservice.v1.DeleteNamespaceRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.operatorservice.v1.DeleteNamespaceResponse: + return await self.client._rpc_call( + rpc="delete_namespace", + req=req, + service=self.service, + resp_type=temporalio.api.operatorservice.v1.DeleteNamespaceResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_nexus_endpoint( + self, + req: temporalio.api.operatorservice.v1.DeleteNexusEndpointRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.operatorservice.v1.DeleteNexusEndpointResponse: + return await self.client._rpc_call( + rpc="delete_nexus_endpoint", + req=req, + service=self.service, + resp_type=temporalio.api.operatorservice.v1.DeleteNexusEndpointResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_nexus_endpoint( + self, + req: temporalio.api.operatorservice.v1.GetNexusEndpointRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.operatorservice.v1.GetNexusEndpointResponse: + return await self.client._rpc_call( + rpc="get_nexus_endpoint", + req=req, + service=self.service, + resp_type=temporalio.api.operatorservice.v1.GetNexusEndpointResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_clusters( + self, + req: temporalio.api.operatorservice.v1.ListClustersRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.operatorservice.v1.ListClustersResponse: + return await self.client._rpc_call( + rpc="list_clusters", + req=req, + service=self.service, + resp_type=temporalio.api.operatorservice.v1.ListClustersResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_nexus_endpoints( + self, + req: temporalio.api.operatorservice.v1.ListNexusEndpointsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.operatorservice.v1.ListNexusEndpointsResponse: + return await self.client._rpc_call( + rpc="list_nexus_endpoints", + req=req, + service=self.service, + resp_type=temporalio.api.operatorservice.v1.ListNexusEndpointsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def list_search_attributes( + self, + req: temporalio.api.operatorservice.v1.ListSearchAttributesRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.operatorservice.v1.ListSearchAttributesResponse: + return await self.client._rpc_call( + rpc="list_search_attributes", + req=req, + service=self.service, + resp_type=temporalio.api.operatorservice.v1.ListSearchAttributesResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def remove_remote_cluster( + self, + req: temporalio.api.operatorservice.v1.RemoveRemoteClusterRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.operatorservice.v1.RemoveRemoteClusterResponse: + return await self.client._rpc_call( + rpc="remove_remote_cluster", + req=req, + service=self.service, + resp_type=temporalio.api.operatorservice.v1.RemoveRemoteClusterResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def remove_search_attributes( + self, + req: temporalio.api.operatorservice.v1.RemoveSearchAttributesRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.operatorservice.v1.RemoveSearchAttributesResponse: + return await self.client._rpc_call( + rpc="remove_search_attributes", + req=req, + service=self.service, + resp_type=temporalio.api.operatorservice.v1.RemoveSearchAttributesResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_nexus_endpoint( + self, + req: temporalio.api.operatorservice.v1.UpdateNexusEndpointRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.operatorservice.v1.UpdateNexusEndpointResponse: + return await self.client._rpc_call( + rpc="update_nexus_endpoint", + req=req, + service=self.service, + resp_type=temporalio.api.operatorservice.v1.UpdateNexusEndpointResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + +class CloudService: + def __init__(self, client: ServiceClient): + self.client = client + self.service = "cloud" + + async def add_namespace_region( + self, + req: temporalio.api.cloud.cloudservice.v1.AddNamespaceRegionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.AddNamespaceRegionResponse: + return await self.client._rpc_call( + rpc="add_namespace_region", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.AddNamespaceRegionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def add_user_group_member( + self, + req: temporalio.api.cloud.cloudservice.v1.AddUserGroupMemberRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.AddUserGroupMemberResponse: + return await self.client._rpc_call( + rpc="add_user_group_member", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.AddUserGroupMemberResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def create_api_key( + self, + req: temporalio.api.cloud.cloudservice.v1.CreateApiKeyRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.CreateApiKeyResponse: + return await self.client._rpc_call( + rpc="create_api_key", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.CreateApiKeyResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def create_connectivity_rule( + self, + req: temporalio.api.cloud.cloudservice.v1.CreateConnectivityRuleRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.CreateConnectivityRuleResponse: + return await self.client._rpc_call( + rpc="create_connectivity_rule", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.CreateConnectivityRuleResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def create_namespace( + self, + req: temporalio.api.cloud.cloudservice.v1.CreateNamespaceRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.CreateNamespaceResponse: + return await self.client._rpc_call( + rpc="create_namespace", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.CreateNamespaceResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def create_namespace_export_sink( + self, + req: temporalio.api.cloud.cloudservice.v1.CreateNamespaceExportSinkRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.CreateNamespaceExportSinkResponse: + return await self.client._rpc_call( + rpc="create_namespace_export_sink", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.CreateNamespaceExportSinkResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def create_nexus_endpoint( + self, + req: temporalio.api.cloud.cloudservice.v1.CreateNexusEndpointRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.CreateNexusEndpointResponse: + return await self.client._rpc_call( + rpc="create_nexus_endpoint", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.CreateNexusEndpointResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def create_service_account( + self, + req: temporalio.api.cloud.cloudservice.v1.CreateServiceAccountRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.CreateServiceAccountResponse: + return await self.client._rpc_call( + rpc="create_service_account", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.CreateServiceAccountResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def create_user( + self, + req: temporalio.api.cloud.cloudservice.v1.CreateUserRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.CreateUserResponse: + return await self.client._rpc_call( + rpc="create_user", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.CreateUserResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def create_user_group( + self, + req: temporalio.api.cloud.cloudservice.v1.CreateUserGroupRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.CreateUserGroupResponse: + return await self.client._rpc_call( + rpc="create_user_group", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.CreateUserGroupResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_api_key( + self, + req: temporalio.api.cloud.cloudservice.v1.DeleteApiKeyRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.DeleteApiKeyResponse: + return await self.client._rpc_call( + rpc="delete_api_key", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.DeleteApiKeyResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_connectivity_rule( + self, + req: temporalio.api.cloud.cloudservice.v1.DeleteConnectivityRuleRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.DeleteConnectivityRuleResponse: + return await self.client._rpc_call( + rpc="delete_connectivity_rule", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.DeleteConnectivityRuleResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_namespace( + self, + req: temporalio.api.cloud.cloudservice.v1.DeleteNamespaceRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.DeleteNamespaceResponse: + return await self.client._rpc_call( + rpc="delete_namespace", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.DeleteNamespaceResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_namespace_export_sink( + self, + req: temporalio.api.cloud.cloudservice.v1.DeleteNamespaceExportSinkRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.DeleteNamespaceExportSinkResponse: + return await self.client._rpc_call( + rpc="delete_namespace_export_sink", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.DeleteNamespaceExportSinkResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_namespace_region( + self, + req: temporalio.api.cloud.cloudservice.v1.DeleteNamespaceRegionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.DeleteNamespaceRegionResponse: + return await self.client._rpc_call( + rpc="delete_namespace_region", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.DeleteNamespaceRegionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_nexus_endpoint( + self, + req: temporalio.api.cloud.cloudservice.v1.DeleteNexusEndpointRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.DeleteNexusEndpointResponse: + return await self.client._rpc_call( + rpc="delete_nexus_endpoint", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.DeleteNexusEndpointResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_service_account( + self, + req: temporalio.api.cloud.cloudservice.v1.DeleteServiceAccountRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.DeleteServiceAccountResponse: + return await self.client._rpc_call( + rpc="delete_service_account", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.DeleteServiceAccountResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_user( + self, + req: temporalio.api.cloud.cloudservice.v1.DeleteUserRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.DeleteUserResponse: + return await self.client._rpc_call( + rpc="delete_user", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.DeleteUserResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def delete_user_group( + self, + req: temporalio.api.cloud.cloudservice.v1.DeleteUserGroupRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.DeleteUserGroupResponse: + return await self.client._rpc_call( + rpc="delete_user_group", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.DeleteUserGroupResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def failover_namespace_region( + self, + req: temporalio.api.cloud.cloudservice.v1.FailoverNamespaceRegionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.FailoverNamespaceRegionResponse: + return await self.client._rpc_call( + rpc="failover_namespace_region", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.FailoverNamespaceRegionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_account( + self, + req: temporalio.api.cloud.cloudservice.v1.GetAccountRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetAccountResponse: + return await self.client._rpc_call( + rpc="get_account", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetAccountResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_api_key( + self, + req: temporalio.api.cloud.cloudservice.v1.GetApiKeyRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetApiKeyResponse: + return await self.client._rpc_call( + rpc="get_api_key", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetApiKeyResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_api_keys( + self, + req: temporalio.api.cloud.cloudservice.v1.GetApiKeysRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetApiKeysResponse: + return await self.client._rpc_call( + rpc="get_api_keys", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetApiKeysResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_async_operation( + self, + req: temporalio.api.cloud.cloudservice.v1.GetAsyncOperationRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetAsyncOperationResponse: + return await self.client._rpc_call( + rpc="get_async_operation", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetAsyncOperationResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_connectivity_rule( + self, + req: temporalio.api.cloud.cloudservice.v1.GetConnectivityRuleRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetConnectivityRuleResponse: + return await self.client._rpc_call( + rpc="get_connectivity_rule", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetConnectivityRuleResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_connectivity_rules( + self, + req: temporalio.api.cloud.cloudservice.v1.GetConnectivityRulesRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetConnectivityRulesResponse: + return await self.client._rpc_call( + rpc="get_connectivity_rules", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetConnectivityRulesResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_namespace( + self, + req: temporalio.api.cloud.cloudservice.v1.GetNamespaceRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetNamespaceResponse: + return await self.client._rpc_call( + rpc="get_namespace", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetNamespaceResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_namespace_export_sink( + self, + req: temporalio.api.cloud.cloudservice.v1.GetNamespaceExportSinkRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetNamespaceExportSinkResponse: + return await self.client._rpc_call( + rpc="get_namespace_export_sink", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetNamespaceExportSinkResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_namespace_export_sinks( + self, + req: temporalio.api.cloud.cloudservice.v1.GetNamespaceExportSinksRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetNamespaceExportSinksResponse: + return await self.client._rpc_call( + rpc="get_namespace_export_sinks", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetNamespaceExportSinksResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_namespaces( + self, + req: temporalio.api.cloud.cloudservice.v1.GetNamespacesRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetNamespacesResponse: + return await self.client._rpc_call( + rpc="get_namespaces", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetNamespacesResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_nexus_endpoint( + self, + req: temporalio.api.cloud.cloudservice.v1.GetNexusEndpointRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetNexusEndpointResponse: + return await self.client._rpc_call( + rpc="get_nexus_endpoint", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetNexusEndpointResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_nexus_endpoints( + self, + req: temporalio.api.cloud.cloudservice.v1.GetNexusEndpointsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetNexusEndpointsResponse: + return await self.client._rpc_call( + rpc="get_nexus_endpoints", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetNexusEndpointsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_region( + self, + req: temporalio.api.cloud.cloudservice.v1.GetRegionRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetRegionResponse: + return await self.client._rpc_call( + rpc="get_region", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetRegionResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_regions( + self, + req: temporalio.api.cloud.cloudservice.v1.GetRegionsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetRegionsResponse: + return await self.client._rpc_call( + rpc="get_regions", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetRegionsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_service_account( + self, + req: temporalio.api.cloud.cloudservice.v1.GetServiceAccountRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetServiceAccountResponse: + return await self.client._rpc_call( + rpc="get_service_account", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetServiceAccountResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_service_accounts( + self, + req: temporalio.api.cloud.cloudservice.v1.GetServiceAccountsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetServiceAccountsResponse: + return await self.client._rpc_call( + rpc="get_service_accounts", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetServiceAccountsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_usage( + self, + req: temporalio.api.cloud.cloudservice.v1.GetUsageRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetUsageResponse: + return await self.client._rpc_call( + rpc="get_usage", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetUsageResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_user( + self, + req: temporalio.api.cloud.cloudservice.v1.GetUserRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetUserResponse: + return await self.client._rpc_call( + rpc="get_user", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetUserResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_user_group( + self, + req: temporalio.api.cloud.cloudservice.v1.GetUserGroupRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetUserGroupResponse: + return await self.client._rpc_call( + rpc="get_user_group", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetUserGroupResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_user_group_members( + self, + req: temporalio.api.cloud.cloudservice.v1.GetUserGroupMembersRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetUserGroupMembersResponse: + return await self.client._rpc_call( + rpc="get_user_group_members", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetUserGroupMembersResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_user_groups( + self, + req: temporalio.api.cloud.cloudservice.v1.GetUserGroupsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetUserGroupsResponse: + return await self.client._rpc_call( + rpc="get_user_groups", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetUserGroupsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def get_users( + self, + req: temporalio.api.cloud.cloudservice.v1.GetUsersRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.GetUsersResponse: + return await self.client._rpc_call( + rpc="get_users", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.GetUsersResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def remove_user_group_member( + self, + req: temporalio.api.cloud.cloudservice.v1.RemoveUserGroupMemberRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.RemoveUserGroupMemberResponse: + return await self.client._rpc_call( + rpc="remove_user_group_member", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.RemoveUserGroupMemberResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def rename_custom_search_attribute( + self, + req: temporalio.api.cloud.cloudservice.v1.RenameCustomSearchAttributeRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.RenameCustomSearchAttributeResponse: + return await self.client._rpc_call( + rpc="rename_custom_search_attribute", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.RenameCustomSearchAttributeResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def set_user_group_namespace_access( + self, + req: temporalio.api.cloud.cloudservice.v1.SetUserGroupNamespaceAccessRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.SetUserGroupNamespaceAccessResponse: + return await self.client._rpc_call( + rpc="set_user_group_namespace_access", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.SetUserGroupNamespaceAccessResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def set_user_namespace_access( + self, + req: temporalio.api.cloud.cloudservice.v1.SetUserNamespaceAccessRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.SetUserNamespaceAccessResponse: + return await self.client._rpc_call( + rpc="set_user_namespace_access", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.SetUserNamespaceAccessResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_account( + self, + req: temporalio.api.cloud.cloudservice.v1.UpdateAccountRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.UpdateAccountResponse: + return await self.client._rpc_call( + rpc="update_account", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.UpdateAccountResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_api_key( + self, + req: temporalio.api.cloud.cloudservice.v1.UpdateApiKeyRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.UpdateApiKeyResponse: + return await self.client._rpc_call( + rpc="update_api_key", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.UpdateApiKeyResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_namespace( + self, + req: temporalio.api.cloud.cloudservice.v1.UpdateNamespaceRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.UpdateNamespaceResponse: + return await self.client._rpc_call( + rpc="update_namespace", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.UpdateNamespaceResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_namespace_export_sink( + self, + req: temporalio.api.cloud.cloudservice.v1.UpdateNamespaceExportSinkRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.UpdateNamespaceExportSinkResponse: + return await self.client._rpc_call( + rpc="update_namespace_export_sink", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.UpdateNamespaceExportSinkResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_namespace_tags( + self, + req: temporalio.api.cloud.cloudservice.v1.UpdateNamespaceTagsRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.UpdateNamespaceTagsResponse: + return await self.client._rpc_call( + rpc="update_namespace_tags", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.UpdateNamespaceTagsResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_nexus_endpoint( + self, + req: temporalio.api.cloud.cloudservice.v1.UpdateNexusEndpointRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.UpdateNexusEndpointResponse: + return await self.client._rpc_call( + rpc="update_nexus_endpoint", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.UpdateNexusEndpointResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_service_account( + self, + req: temporalio.api.cloud.cloudservice.v1.UpdateServiceAccountRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.UpdateServiceAccountResponse: + return await self.client._rpc_call( + rpc="update_service_account", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.UpdateServiceAccountResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_user( + self, + req: temporalio.api.cloud.cloudservice.v1.UpdateUserRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.UpdateUserResponse: + return await self.client._rpc_call( + rpc="update_user", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.UpdateUserResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def update_user_group( + self, + req: temporalio.api.cloud.cloudservice.v1.UpdateUserGroupRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.UpdateUserGroupResponse: + return await self.client._rpc_call( + rpc="update_user_group", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.UpdateUserGroupResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def validate_namespace_export_sink( + self, + req: temporalio.api.cloud.cloudservice.v1.ValidateNamespaceExportSinkRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.cloud.cloudservice.v1.ValidateNamespaceExportSinkResponse: + return await self.client._rpc_call( + rpc="validate_namespace_export_sink", + req=req, + service=self.service, + resp_type=temporalio.api.cloud.cloudservice.v1.ValidateNamespaceExportSinkResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + +class TestService: + def __init__(self, client: ServiceClient): + self.client = client + self.service = "test" + + async def get_current_time( + self, + req: google.protobuf.empty_pb2.Empty, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.testservice.v1.GetCurrentTimeResponse: + return await self.client._rpc_call( + rpc="get_current_time", + req=req, + service=self.service, + resp_type=temporalio.api.testservice.v1.GetCurrentTimeResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def lock_time_skipping( + self, + req: temporalio.api.testservice.v1.LockTimeSkippingRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.testservice.v1.LockTimeSkippingResponse: + return await self.client._rpc_call( + rpc="lock_time_skipping", + req=req, + service=self.service, + resp_type=temporalio.api.testservice.v1.LockTimeSkippingResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def sleep( + self, + req: temporalio.api.testservice.v1.SleepRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.testservice.v1.SleepResponse: + return await self.client._rpc_call( + rpc="sleep", + req=req, + service=self.service, + resp_type=temporalio.api.testservice.v1.SleepResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def sleep_until( + self, + req: temporalio.api.testservice.v1.SleepUntilRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.testservice.v1.SleepResponse: + return await self.client._rpc_call( + rpc="sleep_until", + req=req, + service=self.service, + resp_type=temporalio.api.testservice.v1.SleepResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def unlock_time_skipping( + self, + req: temporalio.api.testservice.v1.UnlockTimeSkippingRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.testservice.v1.UnlockTimeSkippingResponse: + return await self.client._rpc_call( + rpc="unlock_time_skipping", + req=req, + service=self.service, + resp_type=temporalio.api.testservice.v1.UnlockTimeSkippingResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + async def unlock_time_skipping_with_sleep( + self, + req: temporalio.api.testservice.v1.SleepRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.api.testservice.v1.SleepResponse: + return await self.client._rpc_call( + rpc="unlock_time_skipping_with_sleep", + req=req, + service=self.service, + resp_type=temporalio.api.testservice.v1.SleepResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) + + +class HealthService: + def __init__(self, client: ServiceClient): + self.client = client + self.service = "health" + + async def check( + self, + req: temporalio.bridge.proto.health.v1.HealthCheckRequest, + retry: bool = False, + metadata: Mapping[str, Union[str, bytes]] = {}, + timeout: Optional[timedelta] = None, + ) -> temporalio.bridge.proto.health.v1.HealthCheckResponse: + return await self.client._rpc_call( + rpc="check", + req=req, + service=self.service, + resp_type=temporalio.bridge.proto.health.v1.HealthCheckResponse, + retry=retry, + metadata=metadata, + timeout=timeout, + ) diff --git a/temporalio/bridge/src/client.rs b/temporalio/bridge/src/client.rs index 0287a5b64..dfbd432a1 100644 --- a/temporalio/bridge/src/client.rs +++ b/temporalio/bridge/src/client.rs @@ -5,8 +5,8 @@ use std::str::FromStr; use std::time::Duration; use temporal_client::{ ClientKeepAliveConfig as CoreClientKeepAliveConfig, ClientOptions, ClientOptionsBuilder, - ConfiguredClient, HealthService, HttpConnectProxyOptions, RetryClient, RetryConfig, - TemporalServiceClientWithMetrics, TestService, TlsConfig, WorkflowService, + ConfiguredClient, HttpConnectProxyOptions, RetryClient, RetryConfig, + TemporalServiceClientWithMetrics, TlsConfig, }; use tonic::metadata::{ AsciiMetadataKey, AsciiMetadataValue, BinaryMetadataKey, BinaryMetadataValue, @@ -22,7 +22,7 @@ type Client = RetryClient>; #[pyclass] pub struct ClientRef { pub(crate) retry_client: Client, - runtime: runtime::Runtime, + pub(crate) runtime: runtime::Runtime, } #[derive(FromPyObject)] @@ -70,10 +70,10 @@ struct ClientHttpConnectProxyConfig { } #[derive(FromPyObject)] -struct RpcCall { - rpc: String, +pub(crate) struct RpcCall { + pub(crate) rpc: String, req: Vec, - retry: bool, + pub(crate) retry: bool, metadata: HashMap, timeout_millis: Option, } @@ -104,17 +104,8 @@ pub fn connect_client<'a>( }) } +#[macro_export] macro_rules! rpc_call { - ($retry_client:ident, $call:ident, $call_name:ident) => { - if $call.retry { - rpc_resp($retry_client.$call_name(rpc_req($call)?).await) - } else { - rpc_resp($retry_client.into_inner().$call_name(rpc_req($call)?).await) - } - }; -} - -macro_rules! rpc_call_on_trait { ($retry_client:ident, $call:ident, $trait:tt, $call_name:ident) => { if $call.retry { rpc_resp($trait::$call_name(&mut $retry_client, rpc_req($call)?).await) @@ -144,415 +135,9 @@ impl ClientRef { fn update_api_key(&self, api_key: Option) { self.retry_client.get_client().set_api_key(api_key); } - - fn call_workflow_service<'p>( - &self, - py: Python<'p>, - call: RpcCall, - ) -> PyResult> { - let mut retry_client = self.retry_client.clone(); - self.runtime.future_into_py(py, async move { - let bytes = match call.rpc.as_str() { - "count_workflow_executions" => { - rpc_call!(retry_client, call, count_workflow_executions) - } - "create_schedule" => { - rpc_call!(retry_client, call, create_schedule) - } - "create_workflow_rule" => { - rpc_call!(retry_client, call, create_workflow_rule) - } - "delete_schedule" => { - rpc_call!(retry_client, call, delete_schedule) - } - "delete_worker_deployment" => { - rpc_call!(retry_client, call, delete_worker_deployment) - } - "delete_worker_deployment_version" => { - rpc_call!(retry_client, call, delete_worker_deployment_version) - } - "delete_workflow_execution" => { - rpc_call!(retry_client, call, delete_workflow_execution) - } - "delete_workflow_rule" => { - rpc_call!(retry_client, call, delete_workflow_rule) - } - "describe_batch_operation" => { - rpc_call!(retry_client, call, describe_batch_operation) - } - "describe_deployment" => { - rpc_call!(retry_client, call, describe_deployment) - } - "deprecate_namespace" => rpc_call!(retry_client, call, deprecate_namespace), - "describe_namespace" => rpc_call!(retry_client, call, describe_namespace), - "describe_schedule" => rpc_call!(retry_client, call, describe_schedule), - "describe_task_queue" => rpc_call!(retry_client, call, describe_task_queue), - "describe_worker_deployment" => { - rpc_call!(retry_client, call, describe_worker_deployment) - } - "describe_worker_deployment_version" => { - rpc_call!(retry_client, call, describe_worker_deployment_version) - } - "describe_workflow_execution" => { - rpc_call!(retry_client, call, describe_workflow_execution) - } - "describe_workflow_rule" => { - rpc_call!(retry_client, call, describe_workflow_rule) - } - "execute_multi_operation" => rpc_call!(retry_client, call, execute_multi_operation), - "fetch_worker_config" => rpc_call!(retry_client, call, fetch_worker_config), - "get_cluster_info" => rpc_call!(retry_client, call, get_cluster_info), - "get_current_deployment" => rpc_call!(retry_client, call, get_current_deployment), - "get_deployment_reachability" => { - rpc_call!(retry_client, call, get_deployment_reachability) - } - "get_search_attributes" => { - rpc_call!(retry_client, call, get_search_attributes) - } - "get_system_info" => rpc_call!(retry_client, call, get_system_info), - "get_worker_build_id_compatibility" => { - rpc_call!(retry_client, call, get_worker_build_id_compatibility) - } - "get_worker_task_reachability" => { - rpc_call!(retry_client, call, get_worker_task_reachability) - } - "get_worker_versioning_rules" => { - rpc_call!(retry_client, call, get_worker_versioning_rules) - } - "get_workflow_execution_history" => { - rpc_call!(retry_client, call, get_workflow_execution_history) - } - "get_workflow_execution_history_reverse" => { - rpc_call!(retry_client, call, get_workflow_execution_history_reverse) - } - "list_archived_workflow_executions" => { - rpc_call!(retry_client, call, list_archived_workflow_executions) - } - "list_closed_workflow_executions" => { - rpc_call!(retry_client, call, list_closed_workflow_executions) - } - "list_deployments" => { - rpc_call!(retry_client, call, list_deployments) - } - "list_namespaces" => rpc_call!(retry_client, call, list_namespaces), - "list_open_workflow_executions" => { - rpc_call!(retry_client, call, list_open_workflow_executions) - } - "list_schedule_matching_times" => { - rpc_call!(retry_client, call, list_schedule_matching_times) - } - "list_schedules" => { - rpc_call!(retry_client, call, list_schedules) - } - "list_task_queue_partitions" => { - rpc_call!(retry_client, call, list_task_queue_partitions) - } - "list_worker_deployments" => { - rpc_call!(retry_client, call, list_worker_deployments) - } - "list_workflow_executions" => { - rpc_call!(retry_client, call, list_workflow_executions) - } - "list_workflow_rules" => { - rpc_call!(retry_client, call, list_workflow_rules) - } - "patch_schedule" => { - rpc_call!(retry_client, call, patch_schedule) - } - "pause_activity" => { - rpc_call!(retry_client, call, pause_activity) - } - "poll_activity_task_queue" => { - rpc_call!(retry_client, call, poll_activity_task_queue) - } - "poll_nexus_task_queue" => rpc_call!(retry_client, call, poll_nexus_task_queue), - "poll_workflow_execution_update" => { - rpc_call!(retry_client, call, poll_workflow_execution_update) - } - "poll_workflow_task_queue" => { - rpc_call!(retry_client, call, poll_workflow_task_queue) - } - "query_workflow" => rpc_call!(retry_client, call, query_workflow), - "record_activity_task_heartbeat" => { - rpc_call!(retry_client, call, record_activity_task_heartbeat) - } - "record_activity_task_heartbeat_by_id" => { - rpc_call!(retry_client, call, record_activity_task_heartbeat_by_id) - } - "register_namespace" => rpc_call!(retry_client, call, register_namespace), - "request_cancel_workflow_execution" => { - rpc_call!(retry_client, call, request_cancel_workflow_execution) - } - "reset_activity" => { - rpc_call!(retry_client, call, reset_activity) - } - "reset_sticky_task_queue" => { - rpc_call!(retry_client, call, reset_sticky_task_queue) - } - "reset_workflow_execution" => { - rpc_call!(retry_client, call, reset_workflow_execution) - } - "respond_activity_task_canceled" => { - rpc_call!(retry_client, call, respond_activity_task_canceled) - } - "respond_activity_task_canceled_by_id" => { - rpc_call!(retry_client, call, respond_activity_task_canceled_by_id) - } - "respond_activity_task_completed" => { - rpc_call!(retry_client, call, respond_activity_task_completed) - } - "respond_activity_task_completed_by_id" => { - rpc_call!(retry_client, call, respond_activity_task_completed_by_id) - } - "respond_activity_task_failed" => { - rpc_call!(retry_client, call, respond_activity_task_failed) - } - "respond_activity_task_failed_by_id" => { - rpc_call!(retry_client, call, respond_activity_task_failed_by_id) - } - "respond_nexus_task_completed" => { - rpc_call!(retry_client, call, respond_nexus_task_completed) - } - "respond_nexus_task_failed" => { - rpc_call!(retry_client, call, respond_nexus_task_failed) - } - "respond_query_task_completed" => { - rpc_call!(retry_client, call, respond_query_task_completed) - } - "respond_workflow_task_completed" => { - rpc_call!(retry_client, call, respond_workflow_task_completed) - } - "respond_workflow_task_failed" => { - rpc_call!(retry_client, call, respond_workflow_task_failed) - } - "scan_workflow_executions" => { - rpc_call!(retry_client, call, scan_workflow_executions) - } - "set_current_deployment" => { - rpc_call!(retry_client, call, set_current_deployment) - } - "set_worker_deployment_current_version" => { - rpc_call!(retry_client, call, set_worker_deployment_current_version) - } - "set_worker_deployment_ramping_version" => { - rpc_call!(retry_client, call, set_worker_deployment_ramping_version) - } - "shutdown_worker" => { - rpc_call!(retry_client, call, shutdown_worker) - } - "signal_with_start_workflow_execution" => { - rpc_call!(retry_client, call, signal_with_start_workflow_execution) - } - "signal_workflow_execution" => { - rpc_call!(retry_client, call, signal_workflow_execution) - } - "start_workflow_execution" => { - rpc_call!(retry_client, call, start_workflow_execution) - } - "terminate_workflow_execution" => { - rpc_call!(retry_client, call, terminate_workflow_execution) - } - "trigger_workflow_rule" => { - rpc_call!(retry_client, call, trigger_workflow_rule) - } - "unpause_activity" => { - rpc_call!(retry_client, call, unpause_activity) - } - "update_namespace" => { - rpc_call_on_trait!(retry_client, call, WorkflowService, update_namespace) - } - "update_schedule" => rpc_call!(retry_client, call, update_schedule), - "update_task_queue_config" => { - rpc_call!(retry_client, call, update_task_queue_config) - } - "update_worker_config" => rpc_call!(retry_client, call, update_worker_config), - "update_worker_deployment_version_metadata" => { - rpc_call!( - retry_client, - call, - update_worker_deployment_version_metadata - ) - } - "update_worker_build_id_compatibility" => { - rpc_call!(retry_client, call, update_worker_build_id_compatibility) - } - "update_worker_versioning_rules" => { - rpc_call!(retry_client, call, update_worker_versioning_rules) - } - "update_workflow_execution" => { - rpc_call!(retry_client, call, update_workflow_execution) - } - "update_workflow_execution_options" => { - rpc_call!(retry_client, call, update_workflow_execution_options) - } - _ => { - return Err(PyValueError::new_err(format!( - "Unknown RPC call {}", - call.rpc - ))) - } - }?; - Ok(bytes) - }) - } - - fn call_operator_service<'p>( - &self, - py: Python<'p>, - call: RpcCall, - ) -> PyResult> { - use temporal_client::OperatorService; - - let mut retry_client = self.retry_client.clone(); - self.runtime.future_into_py(py, async move { - let bytes = match call.rpc.as_str() { - "add_or_update_remote_cluster" => { - rpc_call!(retry_client, call, add_or_update_remote_cluster) - } - "add_search_attributes" => { - rpc_call!(retry_client, call, add_search_attributes) - } - "create_nexus_endpoint" => rpc_call!(retry_client, call, create_nexus_endpoint), - "delete_namespace" => { - rpc_call_on_trait!(retry_client, call, OperatorService, delete_namespace) - } - "delete_nexus_endpoint" => rpc_call!(retry_client, call, delete_nexus_endpoint), - "get_nexus_endpoint" => rpc_call!(retry_client, call, get_nexus_endpoint), - "list_clusters" => rpc_call!(retry_client, call, list_clusters), - "list_nexus_endpoints" => rpc_call!(retry_client, call, list_nexus_endpoints), - "list_search_attributes" => { - rpc_call!(retry_client, call, list_search_attributes) - } - "remove_remote_cluster" => { - rpc_call!(retry_client, call, remove_remote_cluster) - } - "remove_search_attributes" => { - rpc_call!(retry_client, call, remove_search_attributes) - } - "update_nexus_endpoint" => rpc_call!(retry_client, call, update_nexus_endpoint), - _ => { - return Err(PyValueError::new_err(format!( - "Unknown RPC call {}", - call.rpc - ))) - } - }?; - Ok(bytes) - }) - } - - fn call_cloud_service<'p>(&self, py: Python<'p>, call: RpcCall) -> PyResult> { - use temporal_client::CloudService; - - let mut retry_client = self.retry_client.clone(); - self.runtime.future_into_py(py, async move { - let bytes = match call.rpc.as_str() { - "add_namespace_region" => rpc_call!(retry_client, call, add_namespace_region), - "create_api_key" => rpc_call!(retry_client, call, create_api_key), - "create_connectivity_rule" => { - rpc_call!(retry_client, call, create_connectivity_rule) - } - "create_namespace" => rpc_call!(retry_client, call, create_namespace), - "create_service_account" => rpc_call!(retry_client, call, create_service_account), - "create_user_group" => rpc_call!(retry_client, call, create_user_group), - "create_user" => rpc_call!(retry_client, call, create_user), - "delete_api_key" => rpc_call!(retry_client, call, delete_api_key), - "delete_connectivity_rule" => { - rpc_call!(retry_client, call, delete_connectivity_rule) - } - "delete_namespace" => { - rpc_call_on_trait!(retry_client, call, CloudService, delete_namespace) - } - "delete_service_account" => rpc_call!(retry_client, call, delete_service_account), - "delete_user_group" => rpc_call!(retry_client, call, delete_user_group), - "delete_user" => rpc_call!(retry_client, call, delete_user), - "failover_namespace_region" => { - rpc_call!(retry_client, call, failover_namespace_region) - } - "get_api_key" => rpc_call!(retry_client, call, get_api_key), - "get_api_keys" => rpc_call!(retry_client, call, get_api_keys), - "get_async_operation" => rpc_call!(retry_client, call, get_async_operation), - "get_connectivity_rule" => rpc_call!(retry_client, call, get_connectivity_rule), - "get_connectivity_rules" => rpc_call!(retry_client, call, get_connectivity_rules), - "get_namespace" => rpc_call!(retry_client, call, get_namespace), - "get_namespaces" => rpc_call!(retry_client, call, get_namespaces), - "get_region" => rpc_call!(retry_client, call, get_region), - "get_regions" => rpc_call!(retry_client, call, get_regions), - "get_service_account" => rpc_call!(retry_client, call, get_service_account), - "get_service_accounts" => rpc_call!(retry_client, call, get_service_accounts), - "get_user_group" => rpc_call!(retry_client, call, get_user_group), - "get_user_groups" => rpc_call!(retry_client, call, get_user_groups), - "get_user" => rpc_call!(retry_client, call, get_user), - "get_users" => rpc_call!(retry_client, call, get_users), - "rename_custom_search_attribute" => { - rpc_call!(retry_client, call, rename_custom_search_attribute) - } - "set_user_group_namespace_access" => { - rpc_call!(retry_client, call, set_user_group_namespace_access) - } - "set_user_namespace_access" => { - rpc_call!(retry_client, call, set_user_namespace_access) - } - "update_api_key" => rpc_call!(retry_client, call, update_api_key), - "update_namespace" => { - rpc_call_on_trait!(retry_client, call, CloudService, update_namespace) - } - "update_namespace_tags" => rpc_call!(retry_client, call, update_namespace_tags), - "update_service_account" => rpc_call!(retry_client, call, update_service_account), - "update_user_group" => rpc_call!(retry_client, call, update_user_group), - "update_user" => rpc_call!(retry_client, call, update_user), - _ => { - return Err(PyValueError::new_err(format!( - "Unknown RPC call {}", - call.rpc - ))) - } - }?; - Ok(bytes) - }) - } - - fn call_test_service<'p>(&self, py: Python<'p>, call: RpcCall) -> PyResult> { - let mut retry_client = self.retry_client.clone(); - self.runtime.future_into_py(py, async move { - let bytes = match call.rpc.as_str() { - "get_current_time" => rpc_call!(retry_client, call, get_current_time), - "lock_time_skipping" => rpc_call!(retry_client, call, lock_time_skipping), - "sleep_until" => rpc_call!(retry_client, call, sleep_until), - "sleep" => rpc_call!(retry_client, call, sleep), - "unlock_time_skipping_with_sleep" => { - rpc_call!(retry_client, call, unlock_time_skipping_with_sleep) - } - "unlock_time_skipping" => rpc_call!(retry_client, call, unlock_time_skipping), - _ => { - return Err(PyValueError::new_err(format!( - "Unknown RPC call {}", - call.rpc - ))) - } - }?; - Ok(bytes) - }) - } - - fn call_health_service<'p>(&self, py: Python<'p>, call: RpcCall) -> PyResult> { - let mut retry_client = self.retry_client.clone(); - self.runtime.future_into_py(py, async move { - let bytes = match call.rpc.as_str() { - "check" => rpc_call!(retry_client, call, check), - _ => { - return Err(PyValueError::new_err(format!( - "Unknown RPC call {}", - call.rpc - ))) - } - }?; - Ok(bytes) - }) - } } -fn rpc_req(call: RpcCall) -> PyResult> { +pub(crate) fn rpc_req(call: RpcCall) -> PyResult> { let proto = P::decode(&*call.req) .map_err(|err| PyValueError::new_err(format!("Invalid proto: {err}")))?; let mut req = tonic::Request::new(proto); @@ -590,7 +175,7 @@ fn rpc_req(call: RpcCall) -> PyResult(res: Result, tonic::Status>) -> PyResult> +pub(crate) fn rpc_resp

(res: Result, tonic::Status>) -> PyResult> where P: prost::Message, P: Default, diff --git a/temporalio/bridge/src/client_rpc_generated.rs b/temporalio/bridge/src/client_rpc_generated.rs new file mode 100644 index 000000000..659f5d8cf --- /dev/null +++ b/temporalio/bridge/src/client_rpc_generated.rs @@ -0,0 +1,901 @@ +// Generated file. DO NOT EDIT + +use pyo3::exceptions::PyValueError; +use pyo3::prelude::*; + +use super::{ + client::{rpc_req, rpc_resp, ClientRef, RpcCall}, + rpc_call, +}; + +#[pymethods] +impl ClientRef { + fn call_workflow_service<'p>( + &self, + py: Python<'p>, + call: RpcCall, + ) -> PyResult> { + use temporal_client::WorkflowService; + let mut retry_client = self.retry_client.clone(); + self.runtime.future_into_py(py, async move { + let bytes = match call.rpc.as_str() { + "count_workflow_executions" => { + rpc_call!( + retry_client, + call, + WorkflowService, + count_workflow_executions + ) + } + "create_schedule" => { + rpc_call!(retry_client, call, WorkflowService, create_schedule) + } + "create_workflow_rule" => { + rpc_call!(retry_client, call, WorkflowService, create_workflow_rule) + } + "delete_schedule" => { + rpc_call!(retry_client, call, WorkflowService, delete_schedule) + } + "delete_worker_deployment" => { + rpc_call!( + retry_client, + call, + WorkflowService, + delete_worker_deployment + ) + } + "delete_worker_deployment_version" => { + rpc_call!( + retry_client, + call, + WorkflowService, + delete_worker_deployment_version + ) + } + "delete_workflow_execution" => { + rpc_call!( + retry_client, + call, + WorkflowService, + delete_workflow_execution + ) + } + "delete_workflow_rule" => { + rpc_call!(retry_client, call, WorkflowService, delete_workflow_rule) + } + "deprecate_namespace" => { + rpc_call!(retry_client, call, WorkflowService, deprecate_namespace) + } + "describe_batch_operation" => { + rpc_call!( + retry_client, + call, + WorkflowService, + describe_batch_operation + ) + } + "describe_deployment" => { + rpc_call!(retry_client, call, WorkflowService, describe_deployment) + } + "describe_namespace" => { + rpc_call!(retry_client, call, WorkflowService, describe_namespace) + } + "describe_schedule" => { + rpc_call!(retry_client, call, WorkflowService, describe_schedule) + } + "describe_task_queue" => { + rpc_call!(retry_client, call, WorkflowService, describe_task_queue) + } + "describe_worker_deployment" => { + rpc_call!( + retry_client, + call, + WorkflowService, + describe_worker_deployment + ) + } + "describe_worker_deployment_version" => { + rpc_call!( + retry_client, + call, + WorkflowService, + describe_worker_deployment_version + ) + } + "describe_workflow_execution" => { + rpc_call!( + retry_client, + call, + WorkflowService, + describe_workflow_execution + ) + } + "describe_workflow_rule" => { + rpc_call!(retry_client, call, WorkflowService, describe_workflow_rule) + } + "execute_multi_operation" => { + rpc_call!(retry_client, call, WorkflowService, execute_multi_operation) + } + "fetch_worker_config" => { + rpc_call!(retry_client, call, WorkflowService, fetch_worker_config) + } + "get_cluster_info" => { + rpc_call!(retry_client, call, WorkflowService, get_cluster_info) + } + "get_current_deployment" => { + rpc_call!(retry_client, call, WorkflowService, get_current_deployment) + } + "get_deployment_reachability" => { + rpc_call!( + retry_client, + call, + WorkflowService, + get_deployment_reachability + ) + } + "get_search_attributes" => { + rpc_call!(retry_client, call, WorkflowService, get_search_attributes) + } + "get_system_info" => { + rpc_call!(retry_client, call, WorkflowService, get_system_info) + } + "get_worker_build_id_compatibility" => { + rpc_call!( + retry_client, + call, + WorkflowService, + get_worker_build_id_compatibility + ) + } + "get_worker_task_reachability" => { + rpc_call!( + retry_client, + call, + WorkflowService, + get_worker_task_reachability + ) + } + "get_worker_versioning_rules" => { + rpc_call!( + retry_client, + call, + WorkflowService, + get_worker_versioning_rules + ) + } + "get_workflow_execution_history" => { + rpc_call!( + retry_client, + call, + WorkflowService, + get_workflow_execution_history + ) + } + "get_workflow_execution_history_reverse" => { + rpc_call!( + retry_client, + call, + WorkflowService, + get_workflow_execution_history_reverse + ) + } + "list_archived_workflow_executions" => { + rpc_call!( + retry_client, + call, + WorkflowService, + list_archived_workflow_executions + ) + } + "list_batch_operations" => { + rpc_call!(retry_client, call, WorkflowService, list_batch_operations) + } + "list_closed_workflow_executions" => { + rpc_call!( + retry_client, + call, + WorkflowService, + list_closed_workflow_executions + ) + } + "list_deployments" => { + rpc_call!(retry_client, call, WorkflowService, list_deployments) + } + "list_namespaces" => { + rpc_call!(retry_client, call, WorkflowService, list_namespaces) + } + "list_open_workflow_executions" => { + rpc_call!( + retry_client, + call, + WorkflowService, + list_open_workflow_executions + ) + } + "list_schedule_matching_times" => { + rpc_call!( + retry_client, + call, + WorkflowService, + list_schedule_matching_times + ) + } + "list_schedules" => { + rpc_call!(retry_client, call, WorkflowService, list_schedules) + } + "list_task_queue_partitions" => { + rpc_call!( + retry_client, + call, + WorkflowService, + list_task_queue_partitions + ) + } + "list_worker_deployments" => { + rpc_call!(retry_client, call, WorkflowService, list_worker_deployments) + } + "list_workers" => { + rpc_call!(retry_client, call, WorkflowService, list_workers) + } + "list_workflow_executions" => { + rpc_call!( + retry_client, + call, + WorkflowService, + list_workflow_executions + ) + } + "list_workflow_rules" => { + rpc_call!(retry_client, call, WorkflowService, list_workflow_rules) + } + "patch_schedule" => { + rpc_call!(retry_client, call, WorkflowService, patch_schedule) + } + "pause_activity" => { + rpc_call!(retry_client, call, WorkflowService, pause_activity) + } + "poll_activity_task_queue" => { + rpc_call!( + retry_client, + call, + WorkflowService, + poll_activity_task_queue + ) + } + "poll_nexus_task_queue" => { + rpc_call!(retry_client, call, WorkflowService, poll_nexus_task_queue) + } + "poll_workflow_execution_update" => { + rpc_call!( + retry_client, + call, + WorkflowService, + poll_workflow_execution_update + ) + } + "poll_workflow_task_queue" => { + rpc_call!( + retry_client, + call, + WorkflowService, + poll_workflow_task_queue + ) + } + "query_workflow" => { + rpc_call!(retry_client, call, WorkflowService, query_workflow) + } + "record_activity_task_heartbeat" => { + rpc_call!( + retry_client, + call, + WorkflowService, + record_activity_task_heartbeat + ) + } + "record_activity_task_heartbeat_by_id" => { + rpc_call!( + retry_client, + call, + WorkflowService, + record_activity_task_heartbeat_by_id + ) + } + "record_worker_heartbeat" => { + rpc_call!(retry_client, call, WorkflowService, record_worker_heartbeat) + } + "register_namespace" => { + rpc_call!(retry_client, call, WorkflowService, register_namespace) + } + "request_cancel_workflow_execution" => { + rpc_call!( + retry_client, + call, + WorkflowService, + request_cancel_workflow_execution + ) + } + "reset_activity" => { + rpc_call!(retry_client, call, WorkflowService, reset_activity) + } + "reset_sticky_task_queue" => { + rpc_call!(retry_client, call, WorkflowService, reset_sticky_task_queue) + } + "reset_workflow_execution" => { + rpc_call!( + retry_client, + call, + WorkflowService, + reset_workflow_execution + ) + } + "respond_activity_task_canceled" => { + rpc_call!( + retry_client, + call, + WorkflowService, + respond_activity_task_canceled + ) + } + "respond_activity_task_canceled_by_id" => { + rpc_call!( + retry_client, + call, + WorkflowService, + respond_activity_task_canceled_by_id + ) + } + "respond_activity_task_completed" => { + rpc_call!( + retry_client, + call, + WorkflowService, + respond_activity_task_completed + ) + } + "respond_activity_task_completed_by_id" => { + rpc_call!( + retry_client, + call, + WorkflowService, + respond_activity_task_completed_by_id + ) + } + "respond_activity_task_failed" => { + rpc_call!( + retry_client, + call, + WorkflowService, + respond_activity_task_failed + ) + } + "respond_activity_task_failed_by_id" => { + rpc_call!( + retry_client, + call, + WorkflowService, + respond_activity_task_failed_by_id + ) + } + "respond_nexus_task_completed" => { + rpc_call!( + retry_client, + call, + WorkflowService, + respond_nexus_task_completed + ) + } + "respond_nexus_task_failed" => { + rpc_call!( + retry_client, + call, + WorkflowService, + respond_nexus_task_failed + ) + } + "respond_query_task_completed" => { + rpc_call!( + retry_client, + call, + WorkflowService, + respond_query_task_completed + ) + } + "respond_workflow_task_completed" => { + rpc_call!( + retry_client, + call, + WorkflowService, + respond_workflow_task_completed + ) + } + "respond_workflow_task_failed" => { + rpc_call!( + retry_client, + call, + WorkflowService, + respond_workflow_task_failed + ) + } + "scan_workflow_executions" => { + rpc_call!( + retry_client, + call, + WorkflowService, + scan_workflow_executions + ) + } + "set_current_deployment" => { + rpc_call!(retry_client, call, WorkflowService, set_current_deployment) + } + "set_worker_deployment_current_version" => { + rpc_call!( + retry_client, + call, + WorkflowService, + set_worker_deployment_current_version + ) + } + "set_worker_deployment_ramping_version" => { + rpc_call!( + retry_client, + call, + WorkflowService, + set_worker_deployment_ramping_version + ) + } + "shutdown_worker" => { + rpc_call!(retry_client, call, WorkflowService, shutdown_worker) + } + "signal_with_start_workflow_execution" => { + rpc_call!( + retry_client, + call, + WorkflowService, + signal_with_start_workflow_execution + ) + } + "signal_workflow_execution" => { + rpc_call!( + retry_client, + call, + WorkflowService, + signal_workflow_execution + ) + } + "start_batch_operation" => { + rpc_call!(retry_client, call, WorkflowService, start_batch_operation) + } + "start_workflow_execution" => { + rpc_call!( + retry_client, + call, + WorkflowService, + start_workflow_execution + ) + } + "stop_batch_operation" => { + rpc_call!(retry_client, call, WorkflowService, stop_batch_operation) + } + "terminate_workflow_execution" => { + rpc_call!( + retry_client, + call, + WorkflowService, + terminate_workflow_execution + ) + } + "trigger_workflow_rule" => { + rpc_call!(retry_client, call, WorkflowService, trigger_workflow_rule) + } + "unpause_activity" => { + rpc_call!(retry_client, call, WorkflowService, unpause_activity) + } + "update_activity_options" => { + rpc_call!(retry_client, call, WorkflowService, update_activity_options) + } + "update_namespace" => { + rpc_call!(retry_client, call, WorkflowService, update_namespace) + } + "update_schedule" => { + rpc_call!(retry_client, call, WorkflowService, update_schedule) + } + "update_task_queue_config" => { + rpc_call!( + retry_client, + call, + WorkflowService, + update_task_queue_config + ) + } + "update_worker_build_id_compatibility" => { + rpc_call!( + retry_client, + call, + WorkflowService, + update_worker_build_id_compatibility + ) + } + "update_worker_config" => { + rpc_call!(retry_client, call, WorkflowService, update_worker_config) + } + "update_worker_deployment_version_metadata" => { + rpc_call!( + retry_client, + call, + WorkflowService, + update_worker_deployment_version_metadata + ) + } + "update_worker_versioning_rules" => { + rpc_call!( + retry_client, + call, + WorkflowService, + update_worker_versioning_rules + ) + } + "update_workflow_execution" => { + rpc_call!( + retry_client, + call, + WorkflowService, + update_workflow_execution + ) + } + "update_workflow_execution_options" => { + rpc_call!( + retry_client, + call, + WorkflowService, + update_workflow_execution_options + ) + } + _ => { + return Err(PyValueError::new_err(format!( + "Unknown RPC call {}", + call.rpc + ))) + } + }?; + Ok(bytes) + }) + } + + fn call_operator_service<'p>( + &self, + py: Python<'p>, + call: RpcCall, + ) -> PyResult> { + use temporal_client::OperatorService; + let mut retry_client = self.retry_client.clone(); + self.runtime.future_into_py(py, async move { + let bytes = match call.rpc.as_str() { + "add_or_update_remote_cluster" => { + rpc_call!( + retry_client, + call, + OperatorService, + add_or_update_remote_cluster + ) + } + "add_search_attributes" => { + rpc_call!(retry_client, call, OperatorService, add_search_attributes) + } + "create_nexus_endpoint" => { + rpc_call!(retry_client, call, OperatorService, create_nexus_endpoint) + } + "delete_namespace" => { + rpc_call!(retry_client, call, OperatorService, delete_namespace) + } + "delete_nexus_endpoint" => { + rpc_call!(retry_client, call, OperatorService, delete_nexus_endpoint) + } + "get_nexus_endpoint" => { + rpc_call!(retry_client, call, OperatorService, get_nexus_endpoint) + } + "list_clusters" => { + rpc_call!(retry_client, call, OperatorService, list_clusters) + } + "list_nexus_endpoints" => { + rpc_call!(retry_client, call, OperatorService, list_nexus_endpoints) + } + "list_search_attributes" => { + rpc_call!(retry_client, call, OperatorService, list_search_attributes) + } + "remove_remote_cluster" => { + rpc_call!(retry_client, call, OperatorService, remove_remote_cluster) + } + "remove_search_attributes" => { + rpc_call!( + retry_client, + call, + OperatorService, + remove_search_attributes + ) + } + "update_nexus_endpoint" => { + rpc_call!(retry_client, call, OperatorService, update_nexus_endpoint) + } + _ => { + return Err(PyValueError::new_err(format!( + "Unknown RPC call {}", + call.rpc + ))) + } + }?; + Ok(bytes) + }) + } + + fn call_cloud_service<'p>(&self, py: Python<'p>, call: RpcCall) -> PyResult> { + use temporal_client::CloudService; + let mut retry_client = self.retry_client.clone(); + self.runtime.future_into_py(py, async move { + let bytes = match call.rpc.as_str() { + "add_namespace_region" => { + rpc_call!(retry_client, call, CloudService, add_namespace_region) + } + "add_user_group_member" => { + rpc_call!(retry_client, call, CloudService, add_user_group_member) + } + "create_api_key" => { + rpc_call!(retry_client, call, CloudService, create_api_key) + } + "create_connectivity_rule" => { + rpc_call!(retry_client, call, CloudService, create_connectivity_rule) + } + "create_namespace" => { + rpc_call!(retry_client, call, CloudService, create_namespace) + } + "create_namespace_export_sink" => { + rpc_call!( + retry_client, + call, + CloudService, + create_namespace_export_sink + ) + } + "create_nexus_endpoint" => { + rpc_call!(retry_client, call, CloudService, create_nexus_endpoint) + } + "create_service_account" => { + rpc_call!(retry_client, call, CloudService, create_service_account) + } + "create_user" => { + rpc_call!(retry_client, call, CloudService, create_user) + } + "create_user_group" => { + rpc_call!(retry_client, call, CloudService, create_user_group) + } + "delete_api_key" => { + rpc_call!(retry_client, call, CloudService, delete_api_key) + } + "delete_connectivity_rule" => { + rpc_call!(retry_client, call, CloudService, delete_connectivity_rule) + } + "delete_namespace" => { + rpc_call!(retry_client, call, CloudService, delete_namespace) + } + "delete_namespace_export_sink" => { + rpc_call!( + retry_client, + call, + CloudService, + delete_namespace_export_sink + ) + } + "delete_namespace_region" => { + rpc_call!(retry_client, call, CloudService, delete_namespace_region) + } + "delete_nexus_endpoint" => { + rpc_call!(retry_client, call, CloudService, delete_nexus_endpoint) + } + "delete_service_account" => { + rpc_call!(retry_client, call, CloudService, delete_service_account) + } + "delete_user" => { + rpc_call!(retry_client, call, CloudService, delete_user) + } + "delete_user_group" => { + rpc_call!(retry_client, call, CloudService, delete_user_group) + } + "failover_namespace_region" => { + rpc_call!(retry_client, call, CloudService, failover_namespace_region) + } + "get_account" => { + rpc_call!(retry_client, call, CloudService, get_account) + } + "get_api_key" => { + rpc_call!(retry_client, call, CloudService, get_api_key) + } + "get_api_keys" => { + rpc_call!(retry_client, call, CloudService, get_api_keys) + } + "get_async_operation" => { + rpc_call!(retry_client, call, CloudService, get_async_operation) + } + "get_connectivity_rule" => { + rpc_call!(retry_client, call, CloudService, get_connectivity_rule) + } + "get_connectivity_rules" => { + rpc_call!(retry_client, call, CloudService, get_connectivity_rules) + } + "get_namespace" => { + rpc_call!(retry_client, call, CloudService, get_namespace) + } + "get_namespace_export_sink" => { + rpc_call!(retry_client, call, CloudService, get_namespace_export_sink) + } + "get_namespace_export_sinks" => { + rpc_call!(retry_client, call, CloudService, get_namespace_export_sinks) + } + "get_namespaces" => { + rpc_call!(retry_client, call, CloudService, get_namespaces) + } + "get_nexus_endpoint" => { + rpc_call!(retry_client, call, CloudService, get_nexus_endpoint) + } + "get_nexus_endpoints" => { + rpc_call!(retry_client, call, CloudService, get_nexus_endpoints) + } + "get_region" => { + rpc_call!(retry_client, call, CloudService, get_region) + } + "get_regions" => { + rpc_call!(retry_client, call, CloudService, get_regions) + } + "get_service_account" => { + rpc_call!(retry_client, call, CloudService, get_service_account) + } + "get_service_accounts" => { + rpc_call!(retry_client, call, CloudService, get_service_accounts) + } + "get_usage" => { + rpc_call!(retry_client, call, CloudService, get_usage) + } + "get_user" => { + rpc_call!(retry_client, call, CloudService, get_user) + } + "get_user_group" => { + rpc_call!(retry_client, call, CloudService, get_user_group) + } + "get_user_group_members" => { + rpc_call!(retry_client, call, CloudService, get_user_group_members) + } + "get_user_groups" => { + rpc_call!(retry_client, call, CloudService, get_user_groups) + } + "get_users" => { + rpc_call!(retry_client, call, CloudService, get_users) + } + "remove_user_group_member" => { + rpc_call!(retry_client, call, CloudService, remove_user_group_member) + } + "rename_custom_search_attribute" => { + rpc_call!( + retry_client, + call, + CloudService, + rename_custom_search_attribute + ) + } + "set_user_group_namespace_access" => { + rpc_call!( + retry_client, + call, + CloudService, + set_user_group_namespace_access + ) + } + "set_user_namespace_access" => { + rpc_call!(retry_client, call, CloudService, set_user_namespace_access) + } + "update_account" => { + rpc_call!(retry_client, call, CloudService, update_account) + } + "update_api_key" => { + rpc_call!(retry_client, call, CloudService, update_api_key) + } + "update_namespace" => { + rpc_call!(retry_client, call, CloudService, update_namespace) + } + "update_namespace_export_sink" => { + rpc_call!( + retry_client, + call, + CloudService, + update_namespace_export_sink + ) + } + "update_namespace_tags" => { + rpc_call!(retry_client, call, CloudService, update_namespace_tags) + } + "update_nexus_endpoint" => { + rpc_call!(retry_client, call, CloudService, update_nexus_endpoint) + } + "update_service_account" => { + rpc_call!(retry_client, call, CloudService, update_service_account) + } + "update_user" => { + rpc_call!(retry_client, call, CloudService, update_user) + } + "update_user_group" => { + rpc_call!(retry_client, call, CloudService, update_user_group) + } + "validate_namespace_export_sink" => { + rpc_call!( + retry_client, + call, + CloudService, + validate_namespace_export_sink + ) + } + _ => { + return Err(PyValueError::new_err(format!( + "Unknown RPC call {}", + call.rpc + ))) + } + }?; + Ok(bytes) + }) + } + + fn call_test_service<'p>(&self, py: Python<'p>, call: RpcCall) -> PyResult> { + use temporal_client::TestService; + let mut retry_client = self.retry_client.clone(); + self.runtime.future_into_py(py, async move { + let bytes = match call.rpc.as_str() { + "get_current_time" => { + rpc_call!(retry_client, call, TestService, get_current_time) + } + "lock_time_skipping" => { + rpc_call!(retry_client, call, TestService, lock_time_skipping) + } + "sleep" => { + rpc_call!(retry_client, call, TestService, sleep) + } + "sleep_until" => { + rpc_call!(retry_client, call, TestService, sleep_until) + } + "unlock_time_skipping" => { + rpc_call!(retry_client, call, TestService, unlock_time_skipping) + } + "unlock_time_skipping_with_sleep" => { + rpc_call!( + retry_client, + call, + TestService, + unlock_time_skipping_with_sleep + ) + } + _ => { + return Err(PyValueError::new_err(format!( + "Unknown RPC call {}", + call.rpc + ))) + } + }?; + Ok(bytes) + }) + } + + fn call_health_service<'p>(&self, py: Python<'p>, call: RpcCall) -> PyResult> { + use temporal_client::HealthService; + let mut retry_client = self.retry_client.clone(); + self.runtime.future_into_py(py, async move { + let bytes = match call.rpc.as_str() { + "check" => { + rpc_call!(retry_client, call, HealthService, check) + } + _ => { + return Err(PyValueError::new_err(format!( + "Unknown RPC call {}", + call.rpc + ))) + } + }?; + Ok(bytes) + }) + } +} diff --git a/temporalio/bridge/src/envconfig.rs b/temporalio/bridge/src/envconfig.rs index da93586c7..9277a4588 100644 --- a/temporalio/bridge/src/envconfig.rs +++ b/temporalio/bridge/src/envconfig.rs @@ -7,9 +7,9 @@ use std::collections::HashMap; use temporal_sdk_core_api::envconfig::{ load_client_config as core_load_client_config, load_client_config_profile as core_load_client_config_profile, - ClientConfig as CoreClientConfig, ClientConfigCodec, ClientConfigProfile as CoreClientConfigProfile, - ClientConfigTLS as CoreClientConfigTLS, DataSource, LoadClientConfigOptions, - LoadClientConfigProfileOptions, + ClientConfig as CoreClientConfig, ClientConfigCodec, + ClientConfigProfile as CoreClientConfigProfile, ClientConfigTLS as CoreClientConfigTLS, + DataSource, LoadClientConfigOptions, LoadClientConfigProfileOptions, }; pyo3::create_exception!(temporal_sdk_bridge, ConfigError, PyRuntimeError); @@ -143,12 +143,7 @@ pub fn load_client_config( )) } }; - load_client_config_inner( - py, - config_source, - config_file_strict, - env_vars, - ) + load_client_config_inner(py, config_source, config_file_strict, env_vars) } #[pyfunction] @@ -183,4 +178,4 @@ pub fn load_client_connect_config( config_file_strict, env_vars, ) -} \ No newline at end of file +} diff --git a/temporalio/bridge/src/lib.rs b/temporalio/bridge/src/lib.rs index 0281e9210..cbd5be10e 100644 --- a/temporalio/bridge/src/lib.rs +++ b/temporalio/bridge/src/lib.rs @@ -2,6 +2,7 @@ use pyo3::prelude::*; use pyo3::types::PyTuple; mod client; +mod client_rpc_generated; mod envconfig; mod metric; mod runtime; @@ -60,10 +61,7 @@ fn temporal_sdk_bridge(py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> { let envconfig_module = PyModule::new(py, "envconfig")?; envconfig_module.add("ConfigError", py.get_type::())?; envconfig_module.add_function(wrap_pyfunction!(envconfig::load_client_config, m)?)?; - envconfig_module.add_function(wrap_pyfunction!( - envconfig::load_client_connect_config, - m - )?)?; + envconfig_module.add_function(wrap_pyfunction!(envconfig::load_client_connect_config, m)?)?; m.add_submodule(&envconfig_module)?; Ok(()) diff --git a/temporalio/bridge/src/metric.rs b/temporalio/bridge/src/metric.rs index 3b24d5974..bc516a08a 100644 --- a/temporalio/bridge/src/metric.rs +++ b/temporalio/bridge/src/metric.rs @@ -107,14 +107,11 @@ impl MetricMeterRef { unit: Option, ) -> MetricHistogramFloatRef { MetricHistogramFloatRef { - histogram: self - .meter - .inner - .histogram_f64(build_metric_parameters( - name, - description, - unit, - )), + histogram: self.meter.inner.histogram_f64(build_metric_parameters( + name, + description, + unit, + )), } } @@ -125,14 +122,11 @@ impl MetricMeterRef { unit: Option, ) -> MetricHistogramDurationRef { MetricHistogramDurationRef { - histogram: self - .meter - .inner - .histogram_duration(build_metric_parameters( - name, - description, - unit, - )), + histogram: self.meter.inner.histogram_duration(build_metric_parameters( + name, + description, + unit, + )), } } diff --git a/temporalio/bridge/src/runtime.rs b/temporalio/bridge/src/runtime.rs index 84ec2ca42..72cc905ae 100644 --- a/temporalio/bridge/src/runtime.rs +++ b/temporalio/bridge/src/runtime.rs @@ -313,9 +313,8 @@ impl TryFrom for Arc { let mut build = OtelCollectorOptionsBuilder::default(); build .url( - Url::parse(&otel_conf.url).map_err(|err| { - PyValueError::new_err(format!("Invalid OTel URL: {err}")) - })?, + Url::parse(&otel_conf.url) + .map_err(|err| PyValueError::new_err(format!("Invalid OTel URL: {err}")))?, ) .headers(otel_conf.headers) .use_seconds_for_durations(otel_conf.durations_as_seconds); diff --git a/temporalio/bridge/src/worker.rs b/temporalio/bridge/src/worker.rs index ce0103fac..92b43f356 100644 --- a/temporalio/bridge/src/worker.rs +++ b/temporalio/bridge/src/worker.rs @@ -19,7 +19,9 @@ use temporal_sdk_core_api::worker::{ }; use temporal_sdk_core_api::Worker; use temporal_sdk_core_protos::coresdk::workflow_completion::WorkflowActivationCompletion; -use temporal_sdk_core_protos::coresdk::{ActivityHeartbeat, ActivityTaskCompletion, nexus::NexusTaskCompletion}; +use temporal_sdk_core_protos::coresdk::{ + nexus::NexusTaskCompletion, ActivityHeartbeat, ActivityTaskCompletion, +}; use temporal_sdk_core_protos::temporal::api::history::v1::History; use tokio::sync::mpsc::{channel, Sender}; use tokio_stream::wrappers::ReceiverStream; @@ -605,10 +607,11 @@ impl WorkerRef { }) } - fn complete_nexus_task<'p>(&self, + fn complete_nexus_task<'p>( + &self, py: Python<'p>, proto: &Bound<'_, PyBytes>, -) -> PyResult> { + ) -> PyResult> { let worker = self.worker.as_ref().unwrap().clone(); let completion = NexusTaskCompletion::decode(proto.as_bytes()) .map_err(|err| PyValueError::new_err(format!("Invalid proto: {err}")))?; diff --git a/temporalio/service.py b/temporalio/service.py index 6d4d148c3..c77ddbb76 100644 --- a/temporalio/service.py +++ b/temporalio/service.py @@ -11,17 +11,13 @@ from dataclasses import dataclass, field from datetime import timedelta from enum import IntEnum -from typing import ClassVar, Generic, Mapping, Optional, Tuple, Type, TypeVar, Union +from typing import ClassVar, Mapping, Optional, Tuple, Type, TypeVar, Union -import google.protobuf.empty_pb2 import google.protobuf.message -import temporalio.api.cloud.cloudservice.v1 import temporalio.api.common.v1 -import temporalio.api.operatorservice.v1 -import temporalio.api.testservice.v1 -import temporalio.api.workflowservice.v1 import temporalio.bridge.client +import temporalio.bridge.generated.services_generated import temporalio.bridge.proto.health.v1 import temporalio.exceptions import temporalio.runtime @@ -220,12 +216,7 @@ def __init__(self, config: ConnectConfig) -> None: self.operator_service = OperatorService(self) self.cloud_service = CloudService(self) self.test_service = TestService(self) - self._check_health_call = self._new_call( - "check", - temporalio.bridge.proto.health.v1.HealthCheckRequest, - temporalio.bridge.proto.health.v1.HealthCheckResponse, - service="health", - ) + self.health_service = HealthService(self) async def check_health( self, @@ -246,12 +237,13 @@ async def check_health( is unavailable (rare), or raises an error if server/service cannot be reached. """ - resp = await self._check_health_call( + resp = await self.health_service.check( temporalio.bridge.proto.health.v1.HealthCheckRequest(service=service), retry=retry, metadata=metadata, timeout=timeout, ) + return ( resp.status == temporalio.bridge.proto.health.v1.HealthCheckResponse.ServingStatus.SERVING @@ -287,1003 +279,25 @@ async def _rpc_call( ) -> ServiceResponse: raise NotImplementedError - def _new_call( - self, - name: str, - req_type: Type[ServiceRequest], - resp_type: Type[ServiceResponse], - *, - service: str = "workflow", - ) -> ServiceCall[ServiceRequest, ServiceResponse]: - return ServiceCall(self, name, req_type, resp_type, service) - -class WorkflowService: +class WorkflowService(temporalio.bridge.generated.services_generated.WorkflowService): """Client to the Temporal server's workflow service.""" - def __init__(self, client: ServiceClient) -> None: - """Initialize the workflow service.""" - wsv1 = temporalio.api.workflowservice.v1 - self.count_workflow_executions = client._new_call( - "count_workflow_executions", - wsv1.CountWorkflowExecutionsRequest, - wsv1.CountWorkflowExecutionsResponse, - ) - self.create_schedule = client._new_call( - "create_schedule", - wsv1.CreateScheduleRequest, - wsv1.CreateScheduleResponse, - ) - self.create_workflow_rule = client._new_call( - "create_workflow_rule", - wsv1.CreateWorkflowRuleRequest, - wsv1.CreateWorkflowRuleRequest, - ) - self.delete_schedule = client._new_call( - "delete_schedule", - wsv1.DeleteScheduleRequest, - wsv1.DeleteScheduleResponse, - ) - self.delete_worker_deployment = client._new_call( - "delete_worker_deployment", - wsv1.DeleteWorkerDeploymentRequest, - wsv1.DeleteWorkerDeploymentResponse, - ) - self.delete_worker_deployment_version = client._new_call( - "delete_worker_deployment_version", - wsv1.DeleteWorkerDeploymentVersionRequest, - wsv1.DeleteWorkerDeploymentVersionResponse, - ) - self.delete_workflow_execution = client._new_call( - "delete_workflow_execution", - wsv1.DeleteWorkflowExecutionRequest, - wsv1.DeleteWorkflowExecutionResponse, - ) - self.delete_workflow_rule = client._new_call( - "delete_workflow_rule", - wsv1.DeleteWorkflowRuleRequest, - wsv1.DeleteWorkflowRuleResponse, - ) - self.describe_batch_operation = client._new_call( - "describe_batch_operation", - wsv1.DescribeBatchOperationRequest, - wsv1.DescribeBatchOperationResponse, - ) - self.describe_deployment = client._new_call( - "describe_deployment", - wsv1.DescribeDeploymentRequest, - wsv1.DescribeDeploymentResponse, - ) - self.deprecate_namespace = client._new_call( - "deprecate_namespace", - wsv1.DeprecateNamespaceRequest, - wsv1.DeprecateNamespaceResponse, - ) - self.describe_namespace = client._new_call( - "describe_namespace", - wsv1.DescribeNamespaceRequest, - wsv1.DescribeNamespaceResponse, - ) - self.describe_schedule = client._new_call( - "describe_schedule", - wsv1.DescribeScheduleRequest, - wsv1.DescribeScheduleResponse, - ) - self.describe_task_queue = client._new_call( - "describe_task_queue", - wsv1.DescribeTaskQueueRequest, - wsv1.DescribeTaskQueueResponse, - ) - self.describe_worker_deployment = client._new_call( - "describe_worker_deployment", - wsv1.DescribeWorkerDeploymentRequest, - wsv1.DescribeWorkerDeploymentResponse, - ) - self.describe_worker_deployment_version = client._new_call( - "describe_worker_deployment_version", - wsv1.DescribeWorkerDeploymentVersionRequest, - wsv1.DescribeWorkerDeploymentVersionResponse, - ) - self.describe_workflow_execution = client._new_call( - "describe_workflow_execution", - wsv1.DescribeWorkflowExecutionRequest, - wsv1.DescribeWorkflowExecutionResponse, - ) - self.describe_workflow_rule = client._new_call( - "describe_workflow_rule", - wsv1.DescribeWorkflowRuleRequest, - wsv1.DescribeWorkflowRuleResponse, - ) - self.execute_multi_operation = client._new_call( - "execute_multi_operation", - wsv1.ExecuteMultiOperationRequest, - wsv1.ExecuteMultiOperationResponse, - ) - self.fetch_worker_config = client._new_call( - "fetch_worker_config", - wsv1.FetchWorkerConfigRequest, - wsv1.FetchWorkerConfigResponse, - ) - self.get_cluster_info = client._new_call( - "get_cluster_info", - wsv1.GetClusterInfoRequest, - wsv1.GetClusterInfoResponse, - ) - self.get_current_deployment = client._new_call( - "get_current_deployment", - wsv1.GetCurrentDeploymentRequest, - wsv1.GetCurrentDeploymentResponse, - ) - self.get_deployment_reachability = client._new_call( - "get_deployment_reachability", - wsv1.GetDeploymentReachabilityRequest, - wsv1.GetDeploymentReachabilityResponse, - ) - self.get_search_attributes = client._new_call( - "get_search_attributes", - wsv1.GetSearchAttributesRequest, - wsv1.GetSearchAttributesResponse, - ) - self.get_system_info = client._new_call( - "get_system_info", - wsv1.GetSystemInfoRequest, - wsv1.GetSystemInfoResponse, - ) - self.get_worker_build_id_compatibility = client._new_call( - "get_worker_build_id_compatibility", - wsv1.GetWorkerBuildIdCompatibilityRequest, - wsv1.GetWorkerBuildIdCompatibilityResponse, - ) - self.get_worker_task_reachability = client._new_call( - "get_worker_task_reachability", - wsv1.GetWorkerTaskReachabilityRequest, - wsv1.GetWorkerTaskReachabilityResponse, - ) - self.get_worker_versioning_rules = client._new_call( - "get_worker_versioning_rules", - wsv1.GetWorkerVersioningRulesRequest, - wsv1.GetWorkerVersioningRulesResponse, - ) - self.get_workflow_execution_history = client._new_call( - "get_workflow_execution_history", - wsv1.GetWorkflowExecutionHistoryRequest, - wsv1.GetWorkflowExecutionHistoryResponse, - ) - self.get_workflow_execution_history_reverse = client._new_call( - "get_workflow_execution_history_reverse", - wsv1.GetWorkflowExecutionHistoryReverseRequest, - wsv1.GetWorkflowExecutionHistoryReverseResponse, - ) - self.list_archived_workflow_executions = client._new_call( - "list_archived_workflow_executions", - wsv1.ListArchivedWorkflowExecutionsRequest, - wsv1.ListArchivedWorkflowExecutionsResponse, - ) - self.list_batch_operations = client._new_call( - "list_batch_operations", - wsv1.ListBatchOperationsRequest, - wsv1.ListBatchOperationsResponse, - ) - self.list_closed_workflow_executions = client._new_call( - "list_closed_workflow_executions", - wsv1.ListClosedWorkflowExecutionsRequest, - wsv1.ListClosedWorkflowExecutionsResponse, - ) - self.list_deployments = client._new_call( - "list_deployments", - wsv1.ListDeploymentsRequest, - wsv1.ListDeploymentsResponse, - ) - self.list_namespaces = client._new_call( - "list_namespaces", - wsv1.ListNamespacesRequest, - wsv1.ListNamespacesResponse, - ) - self.list_open_workflow_executions = client._new_call( - "list_open_workflow_executions", - wsv1.ListOpenWorkflowExecutionsRequest, - wsv1.ListOpenWorkflowExecutionsResponse, - ) - self.list_schedule_matching_times = client._new_call( - "list_schedule_matching_times", - wsv1.ListScheduleMatchingTimesRequest, - wsv1.ListScheduleMatchingTimesResponse, - ) - self.list_schedules = client._new_call( - "list_schedules", - wsv1.ListSchedulesRequest, - wsv1.ListSchedulesResponse, - ) - self.list_task_queue_partitions = client._new_call( - "list_task_queue_partitions", - wsv1.ListTaskQueuePartitionsRequest, - wsv1.ListTaskQueuePartitionsResponse, - ) - self.list_worker_deployments = client._new_call( - "list_worker_deployments", - wsv1.ListWorkerDeploymentsRequest, - wsv1.ListWorkerDeploymentsResponse, - ) - self.list_workflow_executions = client._new_call( - "list_workflow_executions", - wsv1.ListWorkflowExecutionsRequest, - wsv1.ListWorkflowExecutionsResponse, - ) - self.list_workers = client._new_call( - "list_workers", - wsv1.ListWorkersRequest, - wsv1.ListWorkersResponse, - ) - self.list_workflow_rules = client._new_call( - "list_workflow_rules", - wsv1.ListWorkflowRulesRequest, - wsv1.ListWorkflowRulesResponse, - ) - self.patch_schedule = client._new_call( - "patch_schedule", - wsv1.PatchScheduleRequest, - wsv1.PatchScheduleResponse, - ) - self.pause_activity = client._new_call( - "pause_activity", - wsv1.PauseActivityRequest, - wsv1.PauseActivityResponse, - ) - self.poll_activity_task_queue = client._new_call( - "poll_activity_task_queue", - wsv1.PollActivityTaskQueueRequest, - wsv1.PollActivityTaskQueueResponse, - ) - self.poll_nexus_task_queue = client._new_call( - "poll_nexus_task_queue", - wsv1.PollNexusTaskQueueRequest, - wsv1.PollNexusTaskQueueResponse, - ) - self.poll_workflow_execution_update = client._new_call( - "poll_workflow_execution_update", - wsv1.PollWorkflowExecutionUpdateRequest, - wsv1.PollWorkflowExecutionUpdateResponse, - ) - self.poll_workflow_task_queue = client._new_call( - "poll_workflow_task_queue", - wsv1.PollWorkflowTaskQueueRequest, - wsv1.PollWorkflowTaskQueueResponse, - ) - self.query_workflow = client._new_call( - "query_workflow", - wsv1.QueryWorkflowRequest, - wsv1.QueryWorkflowResponse, - ) - self.record_activity_task_heartbeat = client._new_call( - "record_activity_task_heartbeat", - wsv1.RecordActivityTaskHeartbeatRequest, - wsv1.RecordActivityTaskHeartbeatResponse, - ) - self.record_activity_task_heartbeat_by_id = client._new_call( - "record_activity_task_heartbeat_by_id", - wsv1.RecordActivityTaskHeartbeatByIdRequest, - wsv1.RecordActivityTaskHeartbeatByIdResponse, - ) - self.record_worker_heartbeat = client._new_call( - "record_worker_heartbeat", - wsv1.RecordWorkerHeartbeatRequest, - wsv1.RecordWorkerHeartbeatResponse, - ) - self.register_namespace = client._new_call( - "register_namespace", - wsv1.RegisterNamespaceRequest, - wsv1.RegisterNamespaceResponse, - ) - self.request_cancel_workflow_execution = client._new_call( - "request_cancel_workflow_execution", - wsv1.RequestCancelWorkflowExecutionRequest, - wsv1.RequestCancelWorkflowExecutionResponse, - ) - self.reset_activity = client._new_call( - "reset_activity", - wsv1.ResetActivityRequest, - wsv1.ResetActivityResponse, - ) - self.reset_sticky_task_queue = client._new_call( - "reset_sticky_task_queue", - wsv1.ResetStickyTaskQueueRequest, - wsv1.ResetStickyTaskQueueResponse, - ) - self.reset_workflow_execution = client._new_call( - "reset_workflow_execution", - wsv1.ResetWorkflowExecutionRequest, - wsv1.ResetWorkflowExecutionResponse, - ) - self.respond_activity_task_canceled = client._new_call( - "respond_activity_task_canceled", - wsv1.RespondActivityTaskCanceledRequest, - wsv1.RespondActivityTaskCanceledResponse, - ) - self.respond_activity_task_canceled_by_id = client._new_call( - "respond_activity_task_canceled_by_id", - wsv1.RespondActivityTaskCanceledByIdRequest, - wsv1.RespondActivityTaskCanceledByIdResponse, - ) - self.respond_activity_task_completed = client._new_call( - "respond_activity_task_completed", - wsv1.RespondActivityTaskCompletedRequest, - wsv1.RespondActivityTaskCompletedResponse, - ) - self.respond_activity_task_completed_by_id = client._new_call( - "respond_activity_task_completed_by_id", - wsv1.RespondActivityTaskCompletedByIdRequest, - wsv1.RespondActivityTaskCompletedByIdResponse, - ) - self.respond_activity_task_failed = client._new_call( - "respond_activity_task_failed", - wsv1.RespondActivityTaskFailedRequest, - wsv1.RespondActivityTaskFailedResponse, - ) - self.respond_activity_task_failed_by_id = client._new_call( - "respond_activity_task_failed_by_id", - wsv1.RespondActivityTaskFailedByIdRequest, - wsv1.RespondActivityTaskFailedByIdResponse, - ) - self.respond_nexus_task_completed = client._new_call( - "respond_nexus_task_completed", - wsv1.RespondNexusTaskCompletedRequest, - wsv1.RespondNexusTaskCompletedResponse, - ) - self.respond_nexus_task_failed = client._new_call( - "respond_nexus_task_failed", - wsv1.RespondNexusTaskFailedRequest, - wsv1.RespondNexusTaskFailedResponse, - ) - self.respond_query_task_completed = client._new_call( - "respond_query_task_completed", - wsv1.RespondQueryTaskCompletedRequest, - wsv1.RespondQueryTaskCompletedResponse, - ) - self.respond_workflow_task_completed = client._new_call( - "respond_workflow_task_completed", - wsv1.RespondWorkflowTaskCompletedRequest, - wsv1.RespondWorkflowTaskCompletedResponse, - ) - self.respond_workflow_task_failed = client._new_call( - "respond_workflow_task_failed", - wsv1.RespondWorkflowTaskFailedRequest, - wsv1.RespondWorkflowTaskFailedResponse, - ) - self.scan_workflow_executions = client._new_call( - "scan_workflow_executions", - wsv1.ScanWorkflowExecutionsRequest, - wsv1.ScanWorkflowExecutionsResponse, - ) - self.set_current_deployment = client._new_call( - "set_current_deployment", - wsv1.SetCurrentDeploymentRequest, - wsv1.SetCurrentDeploymentResponse, - ) - self.set_worker_deployment_current_version = client._new_call( - "set_worker_deployment_current_version", - wsv1.SetWorkerDeploymentCurrentVersionRequest, - wsv1.SetWorkerDeploymentCurrentVersionResponse, - ) - self.set_worker_deployment_ramping_version = client._new_call( - "set_worker_deployment_ramping_version", - wsv1.SetWorkerDeploymentRampingVersionRequest, - wsv1.SetWorkerDeploymentRampingVersionResponse, - ) - self.shutdown_worker = client._new_call( - "shutdown_worker", - wsv1.ShutdownWorkerRequest, - wsv1.ShutdownWorkerResponse, - ) - self.signal_with_start_workflow_execution = client._new_call( - "signal_with_start_workflow_execution", - wsv1.SignalWithStartWorkflowExecutionRequest, - wsv1.SignalWithStartWorkflowExecutionResponse, - ) - self.signal_workflow_execution = client._new_call( - "signal_workflow_execution", - wsv1.SignalWorkflowExecutionRequest, - wsv1.SignalWorkflowExecutionResponse, - ) - self.start_batch_operation = client._new_call( - "start_batch_operation", - wsv1.StartBatchOperationRequest, - wsv1.StartBatchOperationResponse, - ) - self.start_workflow_execution = client._new_call( - "start_workflow_execution", - wsv1.StartWorkflowExecutionRequest, - wsv1.StartWorkflowExecutionResponse, - ) - self.stop_batch_operation = client._new_call( - "stop_batch_operation", - wsv1.StopBatchOperationRequest, - wsv1.StopBatchOperationResponse, - ) - self.terminate_workflow_execution = client._new_call( - "terminate_workflow_execution", - wsv1.TerminateWorkflowExecutionRequest, - wsv1.TerminateWorkflowExecutionResponse, - ) - self.trigger_workflow_rule = client._new_call( - "trigger_workflow_rule", - wsv1.TriggerWorkflowRuleRequest, - wsv1.TriggerWorkflowRuleResponse, - ) - self.unpause_activity = client._new_call( - "unpause_activity", - wsv1.UnpauseActivityRequest, - wsv1.UnpauseActivityResponse, - ) - self.update_activity_options = client._new_call( - "update_activity_options", - wsv1.UpdateActivityOptionsRequest, - wsv1.UpdateActivityOptionsResponse, - ) - self.update_namespace = client._new_call( - "update_namespace", - wsv1.UpdateNamespaceRequest, - wsv1.UpdateNamespaceResponse, - ) - self.update_schedule = client._new_call( - "update_schedule", - wsv1.UpdateScheduleRequest, - wsv1.UpdateScheduleResponse, - ) - self.update_task_queue_config = client._new_call( - "update_task_queue_config", - wsv1.UpdateTaskQueueConfigRequest, - wsv1.UpdateTaskQueueConfigResponse, - ) - self.update_worker_config = client._new_call( - "update_worker_config", - wsv1.UpdateWorkerConfigRequest, - wsv1.UpdateWorkerConfigResponse, - ) - self.update_worker_deployment_version_metadata = client._new_call( - "update_worker_deployment_version_metadata", - wsv1.UpdateWorkerDeploymentVersionMetadataRequest, - wsv1.UpdateWorkerDeploymentVersionMetadataResponse, - ) - self.update_worker_build_id_compatibility = client._new_call( - "update_worker_build_id_compatibility", - wsv1.UpdateWorkerBuildIdCompatibilityRequest, - wsv1.UpdateWorkerBuildIdCompatibilityResponse, - ) - self.update_worker_versioning_rules = client._new_call( - "update_worker_versioning_rules", - wsv1.UpdateWorkerVersioningRulesRequest, - wsv1.UpdateWorkerVersioningRulesResponse, - ) - self.update_workflow_execution = client._new_call( - "update_workflow_execution", - wsv1.UpdateWorkflowExecutionRequest, - wsv1.UpdateWorkflowExecutionResponse, - ) - self.update_workflow_execution_options = client._new_call( - "update_workflow_execution_options", - wsv1.UpdateWorkflowExecutionOptionsRequest, - wsv1.UpdateWorkflowExecutionOptionsResponse, - ) - -class OperatorService: +class OperatorService(temporalio.bridge.generated.services_generated.OperatorService): """Client to the Temporal server's operator service.""" - def __init__(self, client: ServiceClient) -> None: - """Initialize the operator service.""" - osv1 = temporalio.api.operatorservice.v1 - self.add_or_update_remote_cluster = client._new_call( - "add_or_update_remote_cluster", - osv1.AddOrUpdateRemoteClusterRequest, - osv1.AddOrUpdateRemoteClusterResponse, - service="operator", - ) - self.add_search_attributes = client._new_call( - "add_search_attributes", - osv1.AddSearchAttributesRequest, - osv1.AddSearchAttributesResponse, - service="operator", - ) - self.create_nexus_endpoint = client._new_call( - "create_nexus_endpoint", - osv1.CreateNexusEndpointRequest, - osv1.CreateNexusEndpointResponse, - service="operator", - ) - self.delete_nexus_endpoint = client._new_call( - "delete_nexus_endpoint", - osv1.DeleteNexusEndpointRequest, - osv1.DeleteNexusEndpointResponse, - service="operator", - ) - self.delete_namespace = client._new_call( - "delete_namespace", - osv1.DeleteNamespaceRequest, - osv1.DeleteNamespaceResponse, - service="operator", - ) - self.get_nexus_endpoint = client._new_call( - "get_nexus_endpoint", - osv1.GetNexusEndpointRequest, - osv1.GetNexusEndpointResponse, - service="operator", - ) - self.list_clusters = client._new_call( - "list_clusters", - osv1.ListClustersRequest, - osv1.ListClustersResponse, - service="operator", - ) - self.list_nexus_endpoints = client._new_call( - "list_nexus_endpoints", - osv1.ListNexusEndpointsRequest, - osv1.ListNexusEndpointsResponse, - service="operator", - ) - self.list_search_attributes = client._new_call( - "list_search_attributes", - osv1.ListSearchAttributesRequest, - osv1.ListSearchAttributesResponse, - service="operator", - ) - self.remove_remote_cluster = client._new_call( - "remove_remote_cluster", - osv1.RemoveRemoteClusterRequest, - osv1.RemoveRemoteClusterResponse, - service="operator", - ) - self.remove_search_attributes = client._new_call( - "remove_search_attributes", - osv1.RemoveSearchAttributesRequest, - osv1.RemoveSearchAttributesResponse, - service="operator", - ) - self.update_nexus_endpoint = client._new_call( - "update_nexus_endpoint", - osv1.UpdateNexusEndpointRequest, - osv1.UpdateNexusEndpointResponse, - service="operator", - ) - -class CloudService: +class CloudService(temporalio.bridge.generated.services_generated.CloudService): """Client to the Temporal server's cloud service.""" - def __init__(self, client: ServiceClient) -> None: - """Initialize the cloud service.""" - clv1 = temporalio.api.cloud.cloudservice.v1 - self.add_namespace_region = client._new_call( - "add_namespace_region", - clv1.AddNamespaceRegionRequest, - clv1.AddNamespaceRegionResponse, - service="cloud", - ) - self.add_user_group_member = client._new_call( - "add_user_group_member", - clv1.AddUserGroupMemberRequest, - clv1.AddUserGroupMemberResponse, - service="cloud", - ) - self.create_api_key = client._new_call( - "create_api_key", - clv1.CreateApiKeyRequest, - clv1.CreateApiKeyResponse, - service="cloud", - ) - self.create_connectivity_rule = client._new_call( - "create_connectivity_rule", - clv1.CreateConnectivityRuleRequest, - clv1.CreateConnectivityRuleResponse, - service="cloud", - ) - self.create_namespace = client._new_call( - "create_namespace", - clv1.CreateNamespaceRequest, - clv1.CreateNamespaceResponse, - service="cloud", - ) - self.create_namespace_export_sink = client._new_call( - "create_namespace_export_sink", - clv1.CreateNamespaceExportSinkRequest, - clv1.CreateNamespaceExportSinkResponse, - service="cloud", - ) - self.create_nexus_endpoint = client._new_call( - "create_nexus_endpoint", - clv1.CreateNexusEndpointRequest, - clv1.CreateNexusEndpointResponse, - service="cloud", - ) - self.create_service_account = client._new_call( - "create_service_account", - clv1.CreateServiceAccountRequest, - clv1.CreateServiceAccountResponse, - service="cloud", - ) - self.create_user_group = client._new_call( - "create_user_group", - clv1.CreateUserGroupRequest, - clv1.CreateUserGroupResponse, - service="cloud", - ) - self.create_user = client._new_call( - "create_user", - clv1.CreateUserRequest, - clv1.CreateUserResponse, - service="cloud", - ) - self.delete_api_key = client._new_call( - "delete_api_key", - clv1.DeleteApiKeyRequest, - clv1.DeleteApiKeyResponse, - service="cloud", - ) - self.delete_connectivity_rule = client._new_call( - "delete_connectivity_rule", - clv1.DeleteConnectivityRuleRequest, - clv1.DeleteConnectivityRuleResponse, - service="cloud", - ) - self.delete_namespace = client._new_call( - "delete_namespace", - clv1.DeleteNamespaceRequest, - clv1.DeleteNamespaceResponse, - service="cloud", - ) - self.delete_namespace_export_sink = client._new_call( - "delete_namespace_export_sink", - clv1.DeleteNamespaceExportSinkRequest, - clv1.DeleteNamespaceExportSinkResponse, - service="cloud", - ) - self.delete_namespace_region = client._new_call( - "delete_namespace_region", - clv1.DeleteNamespaceRegionRequest, - clv1.DeleteNamespaceRegionResponse, - service="cloud", - ) - self.delete_nexus_endpoint = client._new_call( - "delete_nexus_endpoint", - clv1.DeleteNexusEndpointRequest, - clv1.DeleteNexusEndpointResponse, - service="cloud", - ) - self.delete_service_account = client._new_call( - "delete_service_account", - clv1.DeleteServiceAccountRequest, - clv1.DeleteServiceAccountResponse, - service="cloud", - ) - self.delete_user_group = client._new_call( - "delete_user_group", - clv1.DeleteUserGroupRequest, - clv1.DeleteUserGroupResponse, - service="cloud", - ) - self.delete_user = client._new_call( - "delete_user", - clv1.DeleteUserRequest, - clv1.DeleteUserResponse, - service="cloud", - ) - self.failover_namespace_region = client._new_call( - "failover_namespace_region", - clv1.FailoverNamespaceRegionRequest, - clv1.FailoverNamespaceRegionResponse, - service="cloud", - ) - self.get_account = client._new_call( - "get_account", - clv1.GetAccountRequest, - clv1.GetAccountResponse, - service="cloud", - ) - self.get_api_key = client._new_call( - "get_api_key", - clv1.GetApiKeyRequest, - clv1.GetApiKeyResponse, - service="cloud", - ) - self.get_api_keys = client._new_call( - "get_api_keys", - clv1.GetApiKeysRequest, - clv1.GetApiKeysResponse, - service="cloud", - ) - self.get_async_operation = client._new_call( - "get_async_operation", - clv1.GetAsyncOperationRequest, - clv1.GetAsyncOperationResponse, - service="cloud", - ) - self.get_connectivity_rule = client._new_call( - "get_connectivity_rule", - clv1.GetConnectivityRuleRequest, - clv1.GetConnectivityRuleResponse, - service="cloud", - ) - self.get_connectivity_rules = client._new_call( - "get_connectivity_rules", - clv1.GetConnectivityRulesRequest, - clv1.GetConnectivityRulesResponse, - service="cloud", - ) - self.get_namespace = client._new_call( - "get_namespace", - clv1.GetNamespaceRequest, - clv1.GetNamespaceResponse, - service="cloud", - ) - self.get_namespaces = client._new_call( - "get_namespaces", - clv1.GetNamespacesRequest, - clv1.GetNamespacesResponse, - service="cloud", - ) - self.get_namespace_export_sink = client._new_call( - "get_namespace_export_sink", - clv1.GetNamespaceExportSinkRequest, - clv1.GetNamespaceExportSinkResponse, - service="cloud", - ) - self.get_namespace_export_sinks = client._new_call( - "get_namespace_export_sinks", - clv1.GetNamespaceExportSinksRequest, - clv1.GetNamespaceExportSinksResponse, - service="cloud", - ) - self.get_nexus_endpoint = client._new_call( - "get_nexus_endpoint", - clv1.GetNexusEndpointRequest, - clv1.GetNexusEndpointResponse, - service="cloud", - ) - self.get_nexus_endpoints = client._new_call( - "get_nexus_endpoints", - clv1.GetNexusEndpointsRequest, - clv1.GetNexusEndpointsResponse, - service="cloud", - ) - self.get_region = client._new_call( - "get_region", - clv1.GetRegionRequest, - clv1.GetRegionResponse, - service="cloud", - ) - self.get_regions = client._new_call( - "get_regions", - clv1.GetRegionsRequest, - clv1.GetRegionsResponse, - service="cloud", - ) - self.get_service_account = client._new_call( - "get_service_account", - clv1.GetServiceAccountRequest, - clv1.GetServiceAccountResponse, - service="cloud", - ) - self.get_service_accounts = client._new_call( - "get_service_accounts", - clv1.GetServiceAccountsRequest, - clv1.GetServiceAccountsResponse, - service="cloud", - ) - self.get_usage = client._new_call( - "get_usage", - clv1.GetUsageRequest, - clv1.GetUsageResponse, - service="cloud", - ) - self.get_user_group = client._new_call( - "get_user_group", - clv1.GetUserGroupRequest, - clv1.GetUserGroupResponse, - service="cloud", - ) - self.get_user_group_members = client._new_call( - "get_user_group_members", - clv1.GetUserGroupMembersRequest, - clv1.GetUserGroupMembersResponse, - service="cloud", - ) - self.get_user_groups = client._new_call( - "get_user_groups", - clv1.GetUserGroupsRequest, - clv1.GetUserGroupsResponse, - service="cloud", - ) - self.get_user = client._new_call( - "get_user", - clv1.GetUserRequest, - clv1.GetUserResponse, - service="cloud", - ) - self.get_users = client._new_call( - "get_users", - clv1.GetUsersRequest, - clv1.GetUsersResponse, - service="cloud", - ) - self.remove_user_group_member = client._new_call( - "remove_user_group_member", - clv1.RemoveUserGroupMemberRequest, - clv1.RemoveUserGroupMemberResponse, - service="cloud", - ) - self.rename_custom_search_attribute = client._new_call( - "rename_custom_search_attribute", - clv1.RenameCustomSearchAttributeRequest, - clv1.RenameCustomSearchAttributeResponse, - service="cloud", - ) - self.set_user_group_namespace_access = client._new_call( - "set_user_group_namespace_access", - clv1.SetUserGroupNamespaceAccessRequest, - clv1.SetUserGroupNamespaceAccessResponse, - service="cloud", - ) - self.set_user_namespace_access = client._new_call( - "set_user_namespace_access", - clv1.SetUserNamespaceAccessRequest, - clv1.SetUserNamespaceAccessResponse, - service="cloud", - ) - self.update_account = client._new_call( - "update_account", - clv1.UpdateAccountRequest, - clv1.UpdateAccountResponse, - service="cloud", - ) - self.update_api_key = client._new_call( - "update_api_key", - clv1.UpdateApiKeyRequest, - clv1.UpdateApiKeyResponse, - service="cloud", - ) - self.update_namespace = client._new_call( - "update_namespace", - clv1.UpdateNamespaceRequest, - clv1.UpdateNamespaceResponse, - service="cloud", - ) - self.update_namespace_export_sink = client._new_call( - "update_namespace_export_sink", - clv1.UpdateNamespaceExportSinkRequest, - clv1.UpdateNamespaceExportSinkResponse, - service="cloud", - ) - self.update_namespace_tags = client._new_call( - "update_namespace_tags", - clv1.UpdateNamespaceTagsRequest, - clv1.UpdateNamespaceTagsResponse, - service="cloud", - ) - self.update_nexus_endpoint = client._new_call( - "update_nexus_endpoint", - clv1.UpdateNexusEndpointRequest, - clv1.UpdateNexusEndpointResponse, - service="cloud", - ) - self.update_service_account = client._new_call( - "update_service_account", - clv1.UpdateServiceAccountRequest, - clv1.UpdateServiceAccountResponse, - service="cloud", - ) - self.update_user_group = client._new_call( - "update_user_group", - clv1.UpdateUserGroupRequest, - clv1.UpdateUserGroupResponse, - service="cloud", - ) - self.update_user = client._new_call( - "update_user", - clv1.UpdateUserRequest, - clv1.UpdateUserResponse, - service="cloud", - ) - self.validate_namespace_export_sink = client._new_call( - "validate_namespace_export_sink", - clv1.ValidateNamespaceExportSinkRequest, - clv1.ValidateNamespaceExportSinkResponse, - service="cloud", - ) - -class TestService: +class TestService(temporalio.bridge.generated.services_generated.TestService): """Client to the Temporal test server's test service.""" - def __init__(self, client: ServiceClient) -> None: - """Initialize the test service.""" - tsv1 = temporalio.api.testservice.v1 - self.get_current_time = client._new_call( - "get_current_time", - google.protobuf.empty_pb2.Empty, - tsv1.GetCurrentTimeResponse, - service="test", - ) - self.lock_time_skipping = client._new_call( - "lock_time_skipping", - tsv1.LockTimeSkippingRequest, - tsv1.LockTimeSkippingResponse, - service="test", - ) - self.sleep_until = client._new_call( - "sleep_until", - tsv1.SleepUntilRequest, - tsv1.SleepResponse, - service="test", - ) - self.sleep = client._new_call( - "sleep", - tsv1.SleepRequest, - tsv1.SleepResponse, - service="test", - ) - self.unlock_time_skipping_with_sleep = client._new_call( - "unlock_time_skipping_with_sleep", - tsv1.SleepRequest, - tsv1.SleepResponse, - service="test", - ) - self.unlock_time_skipping = client._new_call( - "unlock_time_skipping", - tsv1.UnlockTimeSkippingRequest, - tsv1.UnlockTimeSkippingResponse, - service="test", - ) - - -class ServiceCall(Generic[ServiceRequest, ServiceResponse]): - """Callable RPC method for services.""" - - def __init__( - self, - service_client: ServiceClient, - name: str, - req_type: Type[ServiceRequest], - resp_type: Type[ServiceResponse], - service: str, - ) -> None: - """Initialize the service call.""" - self.service_client = service_client - self.name = name - self.req_type = req_type - self.resp_type = resp_type - self.service = service - - async def __call__( - self, - req: ServiceRequest, - *, - retry: bool = False, - metadata: Mapping[str, Union[str, bytes]] = {}, - timeout: Optional[timedelta] = None, - ) -> ServiceResponse: - """Invoke underlying client with the given request. - - Args: - req: Request for the call. - retry: If true, will use retry config to retry failed calls. - metadata: Headers used on the RPC call. Keys here override - client-level RPC metadata keys. - timeout: Optional RPC deadline to set for the RPC call. - - Returns: - RPC response. - Raises: - RPCError: Any RPC error that occurs during the call. - """ - return await self.service_client._rpc_call( - self.name, - req, - self.resp_type, - service=self.service, - retry=retry, - metadata=metadata, - timeout=timeout, - ) +class HealthService(temporalio.bridge.generated.services_generated.HealthService): + """Client to the Temporal server's health service.""" class _BridgeServiceClient(ServiceClient): diff --git a/tests/test_client.py b/tests/test_client.py index e1df7258c..3c399f315 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -88,7 +88,6 @@ ) from temporalio.converter import DataConverter from temporalio.exceptions import WorkflowAlreadyStartedError -from temporalio.service import ServiceCall from temporalio.testing import WorkflowEnvironment from tests.helpers import ( assert_eq_eventually, @@ -299,12 +298,7 @@ async def test_terminate(client: Client, worker: ExternalWorker): async def test_rpc_already_exists_error_is_raised(client: Client): - class start_workflow_execution( - ServiceCall[ - temporalio.api.workflowservice.v1.StartWorkflowExecutionRequest, - temporalio.api.workflowservice.v1.StartWorkflowExecutionResponse, - ] - ): + class start_workflow_execution: already_exists_err = RPCError( "fake already exists error", RPCStatusCode.ALREADY_EXISTS, b"" ) diff --git a/tests/test_service.py b/tests/test_service.py index 374ae0869..ba3fc5b1d 100644 --- a/tests/test_service.py +++ b/tests/test_service.py @@ -33,19 +33,20 @@ def assert_all_calls_present( ] = {}, ) -> None: # Collect service calls - service_calls: Dict[str, Tuple[Type, Type]] = {} - for _, call in inspect.getmembers(service): - if isinstance(call, temporalio.service.ServiceCall): - service_calls[call.name] = (call.req_type, call.resp_type) + service_calls = set() + for name, call in inspect.getmembers(service): + # ignore private methods and non-rpc members "client" and "service" + if name[0] != "_" and name != "client" and name != "service": + service_calls.add(name) # Collect gRPC service calls with a fake channel channel = CallCollectingChannel(package, custom_req_resp) new_stub(channel) # Confirm they are the same - missing = channel.calls.keys() - service_calls.keys() + missing = channel.calls.keys() - service_calls assert not missing - added = service_calls.keys() - channel.calls.keys() + added = service_calls - channel.calls.keys() assert not added assert_all_calls_present( diff --git a/tests/worker/test_update_with_start.py b/tests/worker/test_update_with_start.py index c2f4b76e1..c55ee6f70 100644 --- a/tests/worker/test_update_with_start.py +++ b/tests/worker/test_update_with_start.py @@ -27,7 +27,7 @@ WorkflowIDReusePolicy, ) from temporalio.exceptions import ApplicationError, WorkflowAlreadyStartedError -from temporalio.service import RPCError, RPCStatusCode, ServiceCall +from temporalio.service import RPCError, RPCStatusCode from temporalio.testing import WorkflowEnvironment from tests.helpers import ( new_worker, @@ -804,12 +804,7 @@ async def test_update_with_start_two_param(client: Client): # Verify correcting issue #791 async def test_start_update_with_start_empty_details(client: Client): - class execute_multi_operation( - ServiceCall[ - temporalio.api.workflowservice.v1.ExecuteMultiOperationRequest, - temporalio.api.workflowservice.v1.ExecuteMultiOperationResponse, - ] - ): + class execute_multi_operation: empty_details_err = RPCError("empty details", RPCStatusCode.INTERNAL, b"") # Set grpc_status with empty details empty_details_err._grpc_status = temporalio.api.common.v1.GrpcStatus(details=[]) diff --git a/tests/worker/test_workflow.py b/tests/worker/test_workflow.py index 9661ad7cc..0f05d5af5 100644 --- a/tests/worker/test_workflow.py +++ b/tests/worker/test_workflow.py @@ -4838,7 +4838,7 @@ async def patched_call( try: await called.wait() finally: - client.workflow_service.poll_workflow_execution_update = unpatched_call + client.workflow_service.poll_workflow_execution_update = unpatched_call # type: ignore result_task.cancel() with pytest.raises(WorkflowUpdateRPCTimeoutOrCancelledError): await result_task