class documentation

Client for accessing Temporal.

Most users will use connect to create a client. The service property provides access to a raw gRPC client. To create another client, like for a different namespace, Client may be directly instantiated with a service of another.

Clients are not thread-safe and should only be used in the event loop they are first connected in. If a client needs to be used from another thread than where it was created, make sure the event loop where it was created is captured, and then call asyncio.run_coroutine_threadsafe with the client call and that event loop.

Clients do not work across forks since runtimes do not work across forks.

Async Static Method connect Connect to a Temporal server.
Method __init__ Create a Temporal client from a service client.
Method api_key.setter Update the API key for this client.
Method config Config, as a dictionary, used to create this client.
Async Method count_workflows Count workflows.
Async Method create_schedule Create a schedule and return its handle.
Async Method execute_update_with_start_workflow Send an update-with-start request and wait for the update to complete.
Async Method execute_workflow Start a workflow and wait for completion.
Method get_async_activity_handle Get an async activity handle.
Method get_schedule_handle Get a schedule handle for the given ID.
Async Method get_worker_build_id_compatibility Get the Build ID compatibility sets for a specific task queue.
Async Method get_worker_task_reachability Determine if some Build IDs for certain Task Queues could have tasks dispatched to them.
Method get_workflow_handle Get a workflow handle to an existing workflow by its ID.
Method get_workflow_handle_for Get a typed workflow handle to an existing workflow by its ID.
Async Method list_schedules List schedules.
Method list_workflows List workflows.
Method rpc_metadata.setter Update the headers for this client.
Async Method start_update_with_start_workflow Send an update-with-start request and wait for it to be accepted.
Async Method start_workflow Start a workflow and return its handle.
Async Method update_worker_build_id_compatibility Used to add new Build IDs or otherwise update the relative compatibility of Build Ids as defined on a specific task queue for the Worker Versioning feature.
Property api_key API key for every call made by this client.
Property data_converter Data converter used by this client.
Property identity Identity used in calls by this client.
Property namespace Namespace used in calls by this client.
Property operator_service Raw gRPC operator service client.
Property rpc_metadata Headers for every call made by this client.
Property service_client Raw gRPC service client.
Property test_service Raw gRPC test service client.
Property workflow_service Raw gRPC workflow service client.
Async Method _start_update_with_start Undocumented
Instance Variable _config Undocumented
Instance Variable _impl Undocumented
@staticmethod
async def connect(target_host: str, *, namespace: str = 'default', api_key: Optional[str] = None, data_converter: temporalio.converter.DataConverter = temporalio.converter.DataConverter.default, interceptors: Sequence[Interceptor] = [], default_workflow_query_reject_condition: Optional[temporalio.common.QueryRejectCondition] = None, tls: Union[bool, TLSConfig] = False, retry_config: Optional[RetryConfig] = None, keep_alive_config: Optional[KeepAliveConfig] = KeepAliveConfig.default, rpc_metadata: Mapping[str, str] = {}, identity: Optional[str] = None, lazy: bool = False, runtime: Optional[temporalio.runtime.Runtime] = None, http_connect_proxy_config: Optional[HttpConnectProxyConfig] = None) -> Client: (source)

Connect to a Temporal server.

Parameters
target_host:strhost:port for the Temporal server. For local development, this is often "localhost:7233".
namespace:strNamespace to use for client calls.
api_key:Optional[str]API key for Temporal. This becomes the "Authorization" HTTP header with "Bearer " prepended. This is only set if RPC metadata doesn't already have an "authorization" key.
data_converter:temporalio.converter.DataConverterData converter to use for all data conversions to/from payloads.
interceptors:Sequence[Interceptor]

Set of interceptors that are chained together to allow intercepting of client calls. The earlier interceptors wrap the later ones.

Any interceptors that also implement temporalio.worker.Interceptor will be used as worker interceptors too so they should not be given when creating a worker.

default_workflow_query_reject_condition:Optional[temporalio.common.QueryRejectCondition]The default rejection condition for workflow queries if not set during query. See WorkflowHandle.query for details on the rejection condition.
tls:Union[bool, TLSConfig]If false, the default, do not use TLS. If true, use system default TLS configuration. If TLS configuration present, that TLS configuration will be used.
retry_config:Optional[RetryConfig]Retry configuration for direct service calls (when opted in) or all high-level calls made by this client (which all opt-in to retries by default). If unset, a default retry configuration is used.
keep_alive_config:Optional[KeepAliveConfig]Keep-alive configuration for the client connection. Default is to check every 30s and kill the connection if a response doesn't come back in 15s. Can be set to None to disable.
rpc_metadata:Mapping[str, str]Headers to use for all calls to the server. Keys here can be overriden by per-call RPC metadata keys.
identity:Optional[str]Identity for this client. If unset, a default is created based on the version of the SDK.
lazy:boolIf true, the client will not connect until the first call is attempted or a worker is created with it. Lazy clients cannot be used for workers.
runtime:Optional[temporalio.runtime.Runtime]The runtime for this client, or the default if unset.
http_connect_proxy_config:Optional[HttpConnectProxyConfig]Configuration for HTTP CONNECT proxy.
Returns
ClientUndocumented
def __init__(self, service_client: temporalio.service.ServiceClient, *, namespace: str = 'default', data_converter: temporalio.converter.DataConverter = temporalio.converter.DataConverter.default, interceptors: Sequence[Interceptor] = [], default_workflow_query_reject_condition: Optional[temporalio.common.QueryRejectCondition] = None): (source)

Create a Temporal client from a service client.

See connect for details on the parameters.

@api_key.setter
def api_key(self, value: Optional[str]): (source)

Update the API key for this client.

This is only set if RPCmetadata doesn't already have an "authorization" key.

def config(self) -> ClientConfig: (source)

Config, as a dictionary, used to create this client.

This makes a shallow copy of the config each call.

async def count_workflows(self, query: Optional[str] = None, rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None) -> WorkflowExecutionCount: (source)

Count workflows.

Parameters
query:Optional[str]A Temporal visibility filter. See Temporal documentation concerning visibility list filters.
rpc_metadata:Mapping[str, str]Headers used on each RPC call. Keys here override client-level RPC metadata keys.
rpc_timeout:Optional[timedelta]Optional RPC deadline to set for each RPC call.
Returns
WorkflowExecutionCountCount of workflows.
async def create_schedule(self, id: str, schedule: Schedule, *, trigger_immediately: bool = False, backfill: Sequence[ScheduleBackfill] = [], memo: Optional[Mapping[str, Any]] = None, search_attributes: Optional[Union[temporalio.common.TypedSearchAttributes, temporalio.common.SearchAttributes]] = None, static_summary: Optional[str] = None, static_details: Optional[str] = None, rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None) -> ScheduleHandle: (source)

Create a schedule and return its handle.

Parameters
id:strUnique identifier of the schedule.
schedule:ScheduleSchedule to create.
trigger_immediately:boolIf true, trigger one action immediately when creating the schedule.
backfill:Sequence[ScheduleBackfill]Set of time periods to take actions on as if that time passed right now.
memo:Optional[Mapping[str, Any]]Memo for the schedule. Memo for a scheduled workflow is part of the schedule action.
search_attributes:Optional[Union[temporalio.common.TypedSearchAttributes, temporalio.common.SearchAttributes]]Search attributes for the schedule. Search attributes for a scheduled workflow are part of the scheduled action. The dictionary form of this is DEPRECATED, use temporalio.common.TypedSearchAttributes.
static_summary:Optional[str]A single-line fixed summary for this workflow execution that may appear in the UI/CLI. This can be in single-line Temporal markdown format.
static_details:Optional[str]General fixed details for this workflow execution that may appear in UI/CLI. This can be in Temporal markdown format and can span multiple lines. This is a fixed value on the workflow that cannot be updated. For details that can be updated, use temporalio.workflow.get_current_details within the workflow.
rpc_metadata:Mapping[str, str]Headers used on the RPC call. Keys here override client-level RPC metadata keys.
rpc_timeout:Optional[timedelta]Optional RPC deadline to set for the RPC call.
Returns
ScheduleHandleA handle to the created schedule.
Raises
ScheduleAlreadyRunningErrorIf a schedule with this ID is already running.
@overload
async def execute_update_with_start_workflow(self, update: temporalio.workflow.UpdateMethodMultiParam[[SelfType], LocalReturnType], *, start_workflow_operation: WithStartWorkflowOperation[SelfType, Any], id: Optional[str] = None, rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None) -> LocalReturnType:
@overload
async def execute_update_with_start_workflow(self, update: temporalio.workflow.UpdateMethodMultiParam[[SelfType, ParamType], LocalReturnType], arg: ParamType, *, start_workflow_operation: WithStartWorkflowOperation[SelfType, Any], id: Optional[str] = None, rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None) -> LocalReturnType:
@overload
async def execute_update_with_start_workflow(self, update: temporalio.workflow.UpdateMethodMultiParam[MultiParamSpec, LocalReturnType], *, args: MultiParamSpec.args, start_workflow_operation: WithStartWorkflowOperation[SelfType, Any], id: Optional[str] = None, rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None) -> LocalReturnType:
@overload
async def execute_update_with_start_workflow(self, update: str, arg: Any = temporalio.common._arg_unset, *, start_workflow_operation: WithStartWorkflowOperation[Any, Any], args: Sequence[Any] = [], id: Optional[str] = None, result_type: Optional[Type] = None, rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None) -> Any:
(source)

Send an update-with-start request and wait for the update to complete.

A WorkflowIDConflictPolicy must be set in the start_workflow_operation. If the specified workflow execution is not running, a new workflow execution is started and the update is sent in the first workflow task. Alternatively if the specified workflow execution is running then, if the WorkflowIDConflictPolicy is USE_EXISTING, the update is issued against the specified workflow, and if the WorkflowIDConflictPolicy is FAIL, an error is returned. This call will block until the update has completed, and return the update result. Note that this means that the call will not return successfully until the update has been delivered to a worker.

Warning

This API is experimental

Parameters
update:Union[str, Callable]Update function or name on the workflow. arg: Single argument to the update.
arg:AnyUndocumented
start_workflow_operation:WithStartWorkflowOperation[Any, Any]a WithStartWorkflowOperation definining the WorkflowIDConflictPolicy and how to start the workflow in the event that a workflow is started.
args:Sequence[Any]Multiple arguments to the update. Cannot be set if arg is.
id:Optional[str]ID of the update. If not set, the default is a new UUID.
result_type:Optional[Type]For string updates, this can set the specific result type hint to deserialize into.
rpc_metadata:Mapping[str, str]Headers used on the RPC call. Keys here override client-level RPC metadata keys.
rpc_timeout:Optional[timedelta]Optional RPC deadline to set for the RPC call.
Returns
AnyUndocumented
Raises
WorkflowUpdateFailedErrorIf the update failed.
WorkflowUpdateRPCTimeoutOrCancelledErrorThis update call timed out or was cancelled. This doesn't mean the update itself was timed out or cancelled.
RPCErrorThere was some issue starting the workflow or sending the update to the workflow.
@overload
async def execute_workflow(self, workflow: MethodAsyncNoParam[SelfType, ReturnType], *, id: str, task_queue: str, execution_timeout: Optional[timedelta] = None, run_timeout: Optional[timedelta] = None, task_timeout: Optional[timedelta] = None, id_reuse_policy: temporalio.common.WorkflowIDReusePolicy = temporalio.common.WorkflowIDReusePolicy.ALLOW_DUPLICATE, id_conflict_policy: temporalio.common.WorkflowIDConflictPolicy = temporalio.common.WorkflowIDConflictPolicy.UNSPECIFIED, retry_policy: Optional[temporalio.common.RetryPolicy] = None, cron_schedule: str = '', memo: Optional[Mapping[str, Any]] = None, search_attributes: Optional[Union[temporalio.common.TypedSearchAttributes, temporalio.common.SearchAttributes]] = None, static_summary: Optional[str] = None, static_details: Optional[str] = None, start_delay: Optional[timedelta] = None, start_signal: Optional[str] = None, start_signal_args: Sequence[Any] = [], rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None, request_eager_start: bool = False) -> ReturnType:
@overload
async def execute_workflow(self, workflow: MethodAsyncSingleParam[SelfType, ParamType, ReturnType], arg: ParamType, *, id: str, task_queue: str, execution_timeout: Optional[timedelta] = None, run_timeout: Optional[timedelta] = None, task_timeout: Optional[timedelta] = None, id_reuse_policy: temporalio.common.WorkflowIDReusePolicy = temporalio.common.WorkflowIDReusePolicy.ALLOW_DUPLICATE, id_conflict_policy: temporalio.common.WorkflowIDConflictPolicy = temporalio.common.WorkflowIDConflictPolicy.UNSPECIFIED, retry_policy: Optional[temporalio.common.RetryPolicy] = None, cron_schedule: str = '', memo: Optional[Mapping[str, Any]] = None, search_attributes: Optional[Union[temporalio.common.TypedSearchAttributes, temporalio.common.SearchAttributes]] = None, static_summary: Optional[str] = None, static_details: Optional[str] = None, start_delay: Optional[timedelta] = None, start_signal: Optional[str] = None, start_signal_args: Sequence[Any] = [], rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None, request_eager_start: bool = False) -> ReturnType:
@overload
async def execute_workflow(self, workflow: Callable[Concatenate[SelfType, MultiParamSpec], Awaitable[ReturnType]], *, args: Sequence[Any], id: str, task_queue: str, execution_timeout: Optional[timedelta] = None, run_timeout: Optional[timedelta] = None, task_timeout: Optional[timedelta] = None, id_reuse_policy: temporalio.common.WorkflowIDReusePolicy = temporalio.common.WorkflowIDReusePolicy.ALLOW_DUPLICATE, id_conflict_policy: temporalio.common.WorkflowIDConflictPolicy = temporalio.common.WorkflowIDConflictPolicy.UNSPECIFIED, retry_policy: Optional[temporalio.common.RetryPolicy] = None, cron_schedule: str = '', memo: Optional[Mapping[str, Any]] = None, search_attributes: Optional[Union[temporalio.common.TypedSearchAttributes, temporalio.common.SearchAttributes]] = None, static_summary: Optional[str] = None, static_details: Optional[str] = None, start_delay: Optional[timedelta] = None, start_signal: Optional[str] = None, start_signal_args: Sequence[Any] = [], rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None, request_eager_start: bool = False) -> ReturnType:
@overload
async def execute_workflow(self, workflow: str, arg: Any = temporalio.common._arg_unset, *, args: Sequence[Any] = [], id: str, task_queue: str, result_type: Optional[Type] = None, execution_timeout: Optional[timedelta] = None, run_timeout: Optional[timedelta] = None, task_timeout: Optional[timedelta] = None, id_reuse_policy: temporalio.common.WorkflowIDReusePolicy = temporalio.common.WorkflowIDReusePolicy.ALLOW_DUPLICATE, id_conflict_policy: temporalio.common.WorkflowIDConflictPolicy = temporalio.common.WorkflowIDConflictPolicy.UNSPECIFIED, retry_policy: Optional[temporalio.common.RetryPolicy] = None, cron_schedule: str = '', memo: Optional[Mapping[str, Any]] = None, search_attributes: Optional[Union[temporalio.common.TypedSearchAttributes, temporalio.common.SearchAttributes]] = None, static_summary: Optional[str] = None, static_details: Optional[str] = None, start_delay: Optional[timedelta] = None, start_signal: Optional[str] = None, start_signal_args: Sequence[Any] = [], rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None, request_eager_start: bool = False) -> Any:
(source)

Start a workflow and wait for completion.

This is a shortcut for start_workflow + WorkflowHandle.result.

@overload
def get_async_activity_handle(self, *, workflow_id: str, run_id: Optional[str], activity_id: str) -> AsyncActivityHandle:
@overload
def get_async_activity_handle(self, *, task_token: bytes) -> AsyncActivityHandle:
(source)

Get an async activity handle.

Either the workflow_id, run_id, and activity_id can be provided, or a singular task_token can be provided.

Parameters
workflow_id:Optional[str]Workflow ID for the activity. Cannot be set if task_token is set.
run_id:Optional[str]Run ID for the activity. Cannot be set if task_token is set.
activity_id:Optional[str]ID for the activity. Cannot be set if task_token is set.
task_token:Optional[bytes]Task token for the activity. Cannot be set if any of the id parameters are set.
Returns
AsyncActivityHandleA handle that can be used for completion or heartbeat.
def get_schedule_handle(self, id: str) -> ScheduleHandle: (source)

Get a schedule handle for the given ID.

async def get_worker_build_id_compatibility(self, task_queue: str, max_sets: Optional[int] = None, rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None) -> WorkerBuildIdVersionSets: (source)

Get the Build ID compatibility sets for a specific task queue.

For more on this feature, see https://docs.temporal.io/workers#worker-versioning

Warning

This API is experimental

Parameters
task_queue:strThe task queue to target.
max_sets:Optional[int]The maximum number of sets to return. If not specified, all sets will be returned.
rpc_metadata:Mapping[str, str]Headers used on each RPC call. Keys here override client-level RPC metadata keys.
rpc_timeout:Optional[timedelta]Optional RPC deadline to set for each RPC call.
Returns
WorkerBuildIdVersionSetsUndocumented
async def get_worker_task_reachability(self, build_ids: Sequence[str], task_queues: Sequence[str] = [], reachability_type: Optional[TaskReachabilityType] = None, rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None) -> WorkerTaskReachability: (source)

Determine if some Build IDs for certain Task Queues could have tasks dispatched to them.

For more on this feature, see https://docs.temporal.io/workers#worker-versioning

Warning

This API is experimental

Parameters
build_ids:Sequence[str]The Build IDs to query the reachability of. At least one must be specified.
task_queues:Sequence[str]Task Queues to restrict the query to. If not specified, all Task Queues will be searched. When requesting a large number of task queues or all task queues associated with the given Build IDs in a namespace, all Task Queues will be listed in the response but some of them may not contain reachability information due to a server enforced limit. When reaching the limit, task queues that reachability information could not be retrieved for will be marked with a NotFetched entry in {@link BuildIdReachability.taskQueueReachability}. The caller may issue another call to get the reachability for those task queues.
reachability_type:Optional[TaskReachabilityType]The kind of reachability this request is concerned with.
rpc_metadata:Mapping[str, str]Headers used on each RPC call. Keys here override client-level RPC metadata keys.
rpc_timeout:Optional[timedelta]Optional RPC deadline to set for each RPC call.
Returns
WorkerTaskReachabilityUndocumented
def get_workflow_handle(self, workflow_id: str, *, run_id: Optional[str] = None, first_execution_run_id: Optional[str] = None, result_type: Optional[Type] = None) -> WorkflowHandle[Any, Any]: (source)

Get a workflow handle to an existing workflow by its ID.

Parameters
workflow_id:strWorkflow ID to get a handle to.
run_id:Optional[str]Run ID that will be used for all calls.
first_execution_run_id:Optional[str]First execution run ID used for cancellation and termination.
result_type:Optional[Type]The result type to deserialize into if known.
Returns
WorkflowHandle[Any, Any]The workflow handle.
def get_workflow_handle_for(self, workflow: Union[MethodAsyncNoParam[SelfType, ReturnType], MethodAsyncSingleParam[SelfType, Any, ReturnType]], workflow_id: str, *, run_id: Optional[str] = None, first_execution_run_id: Optional[str] = None) -> WorkflowHandle[SelfType, ReturnType]: (source)

Get a typed workflow handle to an existing workflow by its ID.

This is the same as get_workflow_handle but typed.

Parameters
workflow:Union[MethodAsyncNoParam[SelfType, ReturnType], MethodAsyncSingleParam[SelfType, Any, ReturnType]]The workflow run method to use for typing the handle.
workflow_id:strWorkflow ID to get a handle to.
run_id:Optional[str]Run ID that will be used for all calls.
first_execution_run_id:Optional[str]First execution run ID used for cancellation and termination.
Returns
WorkflowHandle[SelfType, ReturnType]The workflow handle.
async def list_schedules(self, query: Optional[str] = None, *, page_size: int = 1000, next_page_token: Optional[bytes] = None, rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None) -> ScheduleAsyncIterator: (source)

List schedules.

This does not make a request until the first iteration is attempted. Therefore any errors will not occur until then.

Note, this list is eventually consistent. Therefore if a schedule is added or deleted, it may not be available in the list immediately.

Parameters
query:Optional[str]A Temporal visibility list filter. See Temporal documentation concerning visibility list filters including behavior when left unset.
page_size:intMaximum number of results for each page.
next_page_token:Optional[bytes]A previously obtained next page token if doing pagination. Usually not needed as the iterator automatically starts from the beginning.
rpc_metadata:Mapping[str, str]Headers used on each RPC call. Keys here override client-level RPC metadata keys.
rpc_timeout:Optional[timedelta]Optional RPC deadline to set for each RPC call.
Returns
ScheduleAsyncIteratorAn async iterator that can be used with async for.
def list_workflows(self, query: Optional[str] = None, *, limit: Optional[int] = None, page_size: int = 1000, next_page_token: Optional[bytes] = None, rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None) -> WorkflowExecutionAsyncIterator: (source)

List workflows.

This does not make a request until the first iteration is attempted. Therefore any errors will not occur until then.

Parameters
query:Optional[str]A Temporal visibility list filter. See Temporal documentation concerning visibility list filters including behavior when left unset.
limit:Optional[int]Maximum number of workflows to return. If unset, all workflows are returned. Only applies if using the returned WorkflowExecutionAsyncIterator. as an async iterator.
page_size:intMaximum number of results for each page.
next_page_token:Optional[bytes]A previously obtained next page token if doing pagination. Usually not needed as the iterator automatically starts from the beginning.
rpc_metadata:Mapping[str, str]Headers used on each RPC call. Keys here override client-level RPC metadata keys.
rpc_timeout:Optional[timedelta]Optional RPC deadline to set for each RPC call.
Returns
WorkflowExecutionAsyncIteratorAn async iterator that can be used with async for.
@rpc_metadata.setter
def rpc_metadata(self, value: Mapping[str, str]): (source)

Update the headers for this client.

Do not mutate this mapping after set. Rather, set an entirely new mapping if changes are needed.

@overload
async def start_update_with_start_workflow(self, update: temporalio.workflow.UpdateMethodMultiParam[[SelfType], LocalReturnType], *, start_workflow_operation: WithStartWorkflowOperation[SelfType, Any], wait_for_stage: WorkflowUpdateStage, id: Optional[str] = None, rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None) -> WorkflowUpdateHandle[LocalReturnType]:
@overload
async def start_update_with_start_workflow(self, update: temporalio.workflow.UpdateMethodMultiParam[[SelfType, ParamType], LocalReturnType], arg: ParamType, *, start_workflow_operation: WithStartWorkflowOperation[SelfType, Any], wait_for_stage: WorkflowUpdateStage, id: Optional[str] = None, rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None) -> WorkflowUpdateHandle[LocalReturnType]:
@overload
async def start_update_with_start_workflow(self, update: temporalio.workflow.UpdateMethodMultiParam[MultiParamSpec, LocalReturnType], *, args: MultiParamSpec.args, start_workflow_operation: WithStartWorkflowOperation[SelfType, Any], wait_for_stage: WorkflowUpdateStage, id: Optional[str] = None, rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None) -> WorkflowUpdateHandle[LocalReturnType]:
@overload
async def start_update_with_start_workflow(self, update: str, arg: Any = temporalio.common._arg_unset, *, start_workflow_operation: WithStartWorkflowOperation[Any, Any], wait_for_stage: WorkflowUpdateStage, args: Sequence[Any] = [], id: Optional[str] = None, result_type: Optional[Type] = None, rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None) -> WorkflowUpdateHandle[Any]:
(source)

Send an update-with-start request and wait for it to be accepted.

A WorkflowIDConflictPolicy must be set in the start_workflow_operation. If the specified workflow execution is not running, a new workflow execution is started and the update is sent in the first workflow task. Alternatively if the specified workflow execution is running then, if the WorkflowIDConflictPolicy is USE_EXISTING, the update is issued against the specified workflow, and if the WorkflowIDConflictPolicy is FAIL, an error is returned. This call will block until the update has been accepted, and return a WorkflowUpdateHandle. Note that this means that the call will not return successfully until the update has been delivered to a worker.

Warning

This API is experimental

Parameters
update:Union[str, Callable]Update function or name on the workflow. arg: Single argument to the update.
arg:AnyUndocumented
start_workflow_operation:WithStartWorkflowOperation[Any, Any]a WithStartWorkflowOperation definining the WorkflowIDConflictPolicy and how to start the workflow in the event that a workflow is started.
wait_for_stage:WorkflowUpdateStageRequired stage to wait until returning: either ACCEPTED or COMPLETED. ADMITTED is not currently supported. See https://docs.temporal.io/workflows#update for more details.
args:Sequence[Any]Multiple arguments to the update. Cannot be set if arg is.
id:Optional[str]ID of the update. If not set, the default is a new UUID.
result_type:Optional[Type]For string updates, this can set the specific result type hint to deserialize into.
rpc_metadata:Mapping[str, str]Headers used on the RPC call. Keys here override client-level RPC metadata keys.
rpc_timeout:Optional[timedelta]Optional RPC deadline to set for the RPC call.
Returns
WorkflowUpdateHandle[Any]Undocumented
Raises
WorkflowUpdateFailedErrorIf the update failed.
WorkflowUpdateRPCTimeoutOrCancelledErrorThis update call timed out or was cancelled. This doesn't mean the update itself was timed out or cancelled.
RPCErrorThere was some issue starting the workflow or sending the update to the workflow.
@overload
async def start_workflow(self, workflow: MethodAsyncNoParam[SelfType, ReturnType], *, id: str, task_queue: str, execution_timeout: Optional[timedelta] = None, run_timeout: Optional[timedelta] = None, task_timeout: Optional[timedelta] = None, id_reuse_policy: temporalio.common.WorkflowIDReusePolicy = temporalio.common.WorkflowIDReusePolicy.ALLOW_DUPLICATE, id_conflict_policy: temporalio.common.WorkflowIDConflictPolicy = temporalio.common.WorkflowIDConflictPolicy.UNSPECIFIED, retry_policy: Optional[temporalio.common.RetryPolicy] = None, cron_schedule: str = '', memo: Optional[Mapping[str, Any]] = None, search_attributes: Optional[Union[temporalio.common.TypedSearchAttributes, temporalio.common.SearchAttributes]] = None, static_summary: Optional[str] = None, static_details: Optional[str] = None, start_delay: Optional[timedelta] = None, start_signal: Optional[str] = None, start_signal_args: Sequence[Any] = [], rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None, request_eager_start: bool = False) -> WorkflowHandle[SelfType, ReturnType]:
@overload
async def start_workflow(self, workflow: MethodAsyncSingleParam[SelfType, ParamType, ReturnType], arg: ParamType, *, id: str, task_queue: str, execution_timeout: Optional[timedelta] = None, run_timeout: Optional[timedelta] = None, task_timeout: Optional[timedelta] = None, id_reuse_policy: temporalio.common.WorkflowIDReusePolicy = temporalio.common.WorkflowIDReusePolicy.ALLOW_DUPLICATE, id_conflict_policy: temporalio.common.WorkflowIDConflictPolicy = temporalio.common.WorkflowIDConflictPolicy.UNSPECIFIED, retry_policy: Optional[temporalio.common.RetryPolicy] = None, cron_schedule: str = '', memo: Optional[Mapping[str, Any]] = None, search_attributes: Optional[Union[temporalio.common.TypedSearchAttributes, temporalio.common.SearchAttributes]] = None, static_summary: Optional[str] = None, static_details: Optional[str] = None, start_delay: Optional[timedelta] = None, start_signal: Optional[str] = None, start_signal_args: Sequence[Any] = [], rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None, request_eager_start: bool = False) -> WorkflowHandle[SelfType, ReturnType]:
@overload
async def start_workflow(self, workflow: Callable[Concatenate[SelfType, MultiParamSpec], Awaitable[ReturnType]], *, args: Sequence[Any], id: str, task_queue: str, execution_timeout: Optional[timedelta] = None, run_timeout: Optional[timedelta] = None, task_timeout: Optional[timedelta] = None, id_reuse_policy: temporalio.common.WorkflowIDReusePolicy = temporalio.common.WorkflowIDReusePolicy.ALLOW_DUPLICATE, id_conflict_policy: temporalio.common.WorkflowIDConflictPolicy = temporalio.common.WorkflowIDConflictPolicy.UNSPECIFIED, retry_policy: Optional[temporalio.common.RetryPolicy] = None, cron_schedule: str = '', memo: Optional[Mapping[str, Any]] = None, search_attributes: Optional[Union[temporalio.common.TypedSearchAttributes, temporalio.common.SearchAttributes]] = None, static_summary: Optional[str] = None, static_details: Optional[str] = None, start_delay: Optional[timedelta] = None, start_signal: Optional[str] = None, start_signal_args: Sequence[Any] = [], rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None, request_eager_start: bool = False) -> WorkflowHandle[SelfType, ReturnType]:
@overload
async def start_workflow(self, workflow: str, arg: Any = temporalio.common._arg_unset, *, args: Sequence[Any] = [], id: str, task_queue: str, result_type: Optional[Type] = None, execution_timeout: Optional[timedelta] = None, run_timeout: Optional[timedelta] = None, task_timeout: Optional[timedelta] = None, id_reuse_policy: temporalio.common.WorkflowIDReusePolicy = temporalio.common.WorkflowIDReusePolicy.ALLOW_DUPLICATE, id_conflict_policy: temporalio.common.WorkflowIDConflictPolicy = temporalio.common.WorkflowIDConflictPolicy.UNSPECIFIED, retry_policy: Optional[temporalio.common.RetryPolicy] = None, cron_schedule: str = '', memo: Optional[Mapping[str, Any]] = None, search_attributes: Optional[Union[temporalio.common.TypedSearchAttributes, temporalio.common.SearchAttributes]] = None, static_summary: Optional[str] = None, static_details: Optional[str] = None, start_delay: Optional[timedelta] = None, start_signal: Optional[str] = None, start_signal_args: Sequence[Any] = [], rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None, request_eager_start: bool = False) -> WorkflowHandle[Any, Any]:
(source)

Start a workflow and return its handle.

Parameters
workflow:Union[str, Callable[..., Awaitable[Any]]]String name or class method decorated with @workflow.run for the workflow to start.
arg:AnySingle argument to the workflow.
args:Sequence[Any]Multiple arguments to the workflow. Cannot be set if arg is.
id:strUnique identifier for the workflow execution.
task_queue:strTask queue to run the workflow on.
result_type:Optional[Type]For string workflows, this can set the specific result type hint to deserialize into.
execution_timeout:Optional[timedelta]Total workflow execution timeout including retries and continue as new.
run_timeout:Optional[timedelta]Timeout of a single workflow run.
task_timeout:Optional[timedelta]Timeout of a single workflow task.
id_reuse_policy:temporalio.common.WorkflowIDReusePolicyHow already-existing IDs are treated.
id_conflict_policy:temporalio.common.WorkflowIDConflictPolicyHow already-running workflows of the same ID are treated. Default is unspecified which effectively means fail the start attempt. This cannot be set if id_reuse_policy is set to terminate if running.
retry_policy:Optional[temporalio.common.RetryPolicy]Retry policy for the workflow.
cron_schedule:strSee https://docs.temporal.io/docs/content/what-is-a-temporal-cron-job/
memo:Optional[Mapping[str, Any]]Memo for the workflow.
search_attributes:Optional[Union[temporalio.common.TypedSearchAttributes, temporalio.common.SearchAttributes]]Search attributes for the workflow. The dictionary form of this is deprecated, use temporalio.common.TypedSearchAttributes.
static_summary:Optional[str]A single-line fixed summary for this workflow execution that may appear in the UI/CLI. This can be in single-line Temporal markdown format.
static_details:Optional[str]General fixed details for this workflow execution that may appear in UI/CLI. This can be in Temporal markdown format and can span multiple lines. This is a fixed value on the workflow that cannot be updated. For details that can be updated, use temporalio.workflow.get_current_details within the workflow.
start_delay:Optional[timedelta]Amount of time to wait before starting the workflow. This does not work with cron_schedule.
start_signal:Optional[str]If present, this signal is sent as signal-with-start instead of traditional workflow start.
start_signal_args:Sequence[Any]Arguments for start_signal if start_signal present.
rpc_metadata:Mapping[str, str]Headers used on the RPC call. Keys here override client-level RPC metadata keys.
rpc_timeout:Optional[timedelta]Optional RPC deadline to set for the RPC call.
request_eager_start:boolPotentially reduce the latency to start this workflow by encouraging the server to start it on a local worker running with this same client. This is currently experimental.
stack_level:intUndocumented
Returns
WorkflowHandle[Any, Any]A workflow handle to the started workflow.
Raises
temporalio.exceptions.WorkflowAlreadyStartedErrorWorkflow has already been started.
RPCErrorWorkflow could not be started for some other reason.
async def update_worker_build_id_compatibility(self, task_queue: str, operation: BuildIdOp, rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None): (source)

Used to add new Build IDs or otherwise update the relative compatibility of Build Ids as defined on a specific task queue for the Worker Versioning feature.

For more on this feature, see https://docs.temporal.io/workers#worker-versioning

Warning

This API is experimental

Parameters
task_queue:strThe task queue to target.
operation:BuildIdOpThe operation to perform.
rpc_metadata:Mapping[str, str]Headers used on each RPC call. Keys here override client-level RPC metadata keys.
rpc_timeout:Optional[timedelta]Optional RPC deadline to set for each RPC call.

API key for every call made by this client.

Data converter used by this client.

Identity used in calls by this client.

Namespace used in calls by this client.

Raw gRPC operator service client.

Headers for every call made by this client.

Do not use mutate this mapping. Rather, set this property with an entirely new mapping to change the headers.

Raw gRPC service client.

Raw gRPC test service client.

Raw gRPC workflow service client.

async def _start_update_with_start(self, update: Union[str, Callable], arg: Any = temporalio.common._arg_unset, *, wait_for_stage: WorkflowUpdateStage, args: Sequence[Any] = [], id: Optional[str] = None, result_type: Optional[Type] = None, start_workflow_operation: WithStartWorkflowOperation[SelfType, ReturnType], rpc_metadata: Mapping[str, str] = {}, rpc_timeout: Optional[timedelta] = None) -> WorkflowUpdateHandle[Any]: (source)

Undocumented

Undocumented

Undocumented