Utilities that can decorate or be called inside workflows.
Class |
|
How an activity cancellation should be handled. |
Class |
|
TypedDict of config that can be used for start_activity and execute_activity . |
Class |
|
Handle returned from start_activity and start_local_activity . |
Class |
|
How a child workflow cancellation should be handled. |
Class |
|
TypedDict of config that can be used for start_child_workflow and execute_child_workflow . |
Class |
|
Handle for interacting with a child workflow. |
Class |
|
Handle for interacting with an external workflow. |
Class |
|
Actions taken if a workflow terminates with running handlers. |
Class |
|
Information about the running workflow. |
Class |
|
TypedDict of config that can be used for start_local_activity and execute_local_activity . |
Class |
|
Adapter that adds details to the log about the running workflow. |
Class |
|
How a child workflow should be handled when the parent closes. |
Class |
|
Information about the parent workflow. |
Class | unsafe |
Contains static methods that should not normally be called during workflow execution except in advanced cases. |
Class |
|
Information about a workflow update. |
Class |
|
Decorated workflow update functions implement this. |
Class |
|
Indicates whether the user intends certain commands to be run on a compatible worker Build Id version or not. |
Exception |
|
Error thrown by continue_as_new . |
Exception |
|
Error that can be thrown during replay for non-deterministic workflow. |
Exception |
|
Error thrown when trying to do mutable workflow calls in a read-only context like a query or update validator. |
Exception |
|
The workflow exited before all signal handlers had finished executing. |
Exception |
|
The workflow exited before all update handlers had finished executing. |
Function | all |
Whether update and signal handlers have finished executing. |
Function | as |
Return an iterator whose values are coroutines. |
Function | continue |
Stop the workflow immediately and continue as new. |
Function | current |
Info for the current update if any. |
Function | defn |
Decorator for workflow classes. |
Function | deprecate |
Mark a patch as deprecated. |
Async Function | execute |
Start an activity and wait for completion. |
Async Function | execute |
Start an activity from a callable class and wait for completion. |
Async Function | execute |
Start an activity from a method and wait for completion. |
Async Function | execute |
Start a child workflow and wait for completion. |
Async Function | execute |
Start a local activity and wait for completion. |
Async Function | execute |
Start a local activity from a callable class and wait for completion. |
Async Function | execute |
Start a local activity from a method and wait for completion. |
Function | extern |
External functions available in the workflow sandbox. |
Function | get |
Get the current details of the workflow which may appear in the UI/CLI. Unlike static details set at start, this value can be updated throughout the life of the workflow and is independent of the static details... |
Function | get |
Get the dynamic query handler if any. |
Function | get |
Get the dynamic signal handler if any. |
Function | get |
Get the dynamic update handler if any. |
Function | get |
Get a workflow handle to an existing workflow by its ID. |
Function | get |
Get a typed workflow handle to an existing workflow by its ID. |
Function | get |
Get the query handler for the given name if any. |
Function | get |
Get the signal handler for the given name if any. |
Function | get |
Get the update handler for the given name if any. |
Function | info |
Current workflow's info. |
Function | init |
Decorator for the workflow init method. |
Function | memo |
Current workflow's memo values, converted without type hints. |
Function | memo |
Memo value for the given key, optional default, and optional type hint. |
Function | metric |
Get the metric meter for the current workflow. |
Function | now |
Current time from the workflow perspective. |
Function | patched |
Patch a workflow. |
Function | payload |
Get the payload converter for the current workflow. |
Function | query |
Decorator for a workflow query method. |
Function | random |
Get a deterministic pseudo-random number generator. |
Function | run |
Decorator for the workflow run method. |
Function | set |
Set the current details of the workflow which may appear in the UI/CLI. Unlike static details set at start, this value can be updated throughout the life of the workflow and is independent of the static details... |
Function | set |
Set or unset the dynamic query handler. |
Function | set |
Set or unset the dynamic signal handler. |
Function | set |
Set or unset the dynamic update handler. |
Function | set |
Set or unset the query handler for the given name. |
Function | set |
Set or unset the signal handler for the given name. |
Function | set |
Set or unset the update handler for the given name. |
Function | signal |
Decorator for a workflow signal method. |
Async Function | sleep |
Sleep for the given duration. |
Function | start |
Start an activity and return its handle. |
Function | start |
Start an activity from a callable class. |
Function | start |
Start an activity from a method. |
Async Function | start |
Start a child workflow and return its handle. |
Function | start |
Start a local activity and return its handle. |
Function | start |
Start a local activity from a callable class. |
Function | start |
Start a local activity from a method. |
Function | time |
Current seconds since the epoch from the workflow perspective. |
Function | time |
Current nanoseconds since the epoch from the workflow perspective. |
Function | update |
Decorator for a workflow update handler method. |
Function | upsert |
Upsert search attributes for this workflow. |
Function | uuid4 |
Get a new, determinism-safe v4 UUID based on random . |
Async Function | wait |
Wait for the Futures or Tasks given by fs to complete. |
Async Function | wait |
Wait on a callback to become true. |
Variable | logger |
Logger that will have contextual workflow details embedded. |
Class | _ |
Undocumented |
Class | _ |
Undocumented |
Class | _ |
Undocumented |
Class | _ |
Undocumented |
Class | _ |
Undocumented |
Class | _ |
Undocumented |
Exception | _ |
Undocumented |
Exception | _ |
Undocumented |
Function | _assert |
Undocumented |
Function | _bind |
Undocumented |
Function | _is |
Undocumented |
Function | _parameters |
Return True if the functions have identical parameter lists, ignoring parameter names. |
Function | _release |
Undocumented |
Function | _set |
Undocumented |
Function | _update |
Decorator for a workflow update validator method. |
Async Function | _wait |
Undocumented |
Type Variable | _FT |
Undocumented |
Variable | _current |
Undocumented |
Variable | _imports |
Undocumented |
Variable | _in |
Undocumented |
Variable | _sandbox |
Undocumented |
Whether update and signal handlers have finished executing.
Consider waiting on this condition before workflow return or continue-as-new, to prevent interruption of in-progress handlers by workflow exit: await workflow.wait_condition(lambda: workflow.all_handlers_finished())
Returns | |
bool | True if there are no in-progress update or signal handler executions. |
Iterable[ Awaitable[ AnyType]]
, *, timeout: Optional[ float]
= None) -> Iterator[ Awaitable[ AnyType]]
:
(source)
¶
Return an iterator whose values are coroutines.
This is a deterministic version of asyncio.as_completed
. This
function should be used instead of that one in workflows.
Any
= temporalio.common._arg_unset, *, args: Sequence[ Any]
= [], task_queue: Optional[ str]
= None, run_timeout: Optional[ timedelta]
= None, task_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, memo: Optional[ Mapping[ str, Any]]
= None, search_attributes: Optional[ Union[ temporalio.common.SearchAttributes, temporalio.common.TypedSearchAttributes]]
= None, versioning_intent: Optional[ VersioningIntent]
= None) -> NoReturn
:MethodAsyncNoParam[ SelfType, Any]
, task_queue: Optional[ str]
= None, run_timeout: Optional[ timedelta]
= None, task_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, memo: Optional[ Mapping[ str, Any]]
= None, search_attributes: Optional[ Union[ temporalio.common.SearchAttributes, temporalio.common.TypedSearchAttributes]]
= None, versioning_intent: Optional[ VersioningIntent]
= None) -> NoReturn
:ParamType
, *, workflow: MethodAsyncSingleParam[ SelfType, ParamType, Any]
, task_queue: Optional[ str]
= None, run_timeout: Optional[ timedelta]
= None, task_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, memo: Optional[ Mapping[ str, Any]]
= None, search_attributes: Optional[ Union[ temporalio.common.SearchAttributes, temporalio.common.TypedSearchAttributes]]
= None, versioning_intent: Optional[ VersioningIntent]
= None) -> NoReturn
:Callable[ Concatenate[ SelfType, MultiParamSpec], Awaitable[ Any]]
, args: Sequence[ Any]
, task_queue: Optional[ str]
= None, run_timeout: Optional[ timedelta]
= None, task_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, memo: Optional[ Mapping[ str, Any]]
= None, search_attributes: Optional[ Union[ temporalio.common.SearchAttributes, temporalio.common.TypedSearchAttributes]]
= None, versioning_intent: Optional[ VersioningIntent]
= None) -> NoReturn
:str
, args: Sequence[ Any]
= [], task_queue: Optional[ str]
= None, run_timeout: Optional[ timedelta]
= None, task_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, memo: Optional[ Mapping[ str, Any]]
= None, search_attributes: Optional[ Union[ temporalio.common.SearchAttributes, temporalio.common.TypedSearchAttributes]]
= None, versioning_intent: Optional[ VersioningIntent]
= None) -> NoReturn
:Stop the workflow immediately and continue as new.
Parameters | |
arg:Any | Single argument to the continued workflow. |
args:Sequence[ | Multiple arguments to the continued workflow. Cannot be set if arg is. |
workflow:Union[ | Specific workflow to continue to. Defaults to the current workflow. |
taskOptional[ | Task queue to run the workflow on. Defaults to the current workflow's task queue. |
runOptional[ | Timeout of a single workflow run. Defaults to the current workflow's run timeout. |
taskOptional[ | Timeout of a single workflow task. Defaults to the current workflow's task timeout. |
retryOptional[ | Undocumented |
memo:Optional[ | Memo for the workflow. Defaults to the current workflow's memo. |
searchOptional[ | Search attributes for the workflow. Defaults to the current workflow's search attributes. The dictionary form of this is DEPRECATED. |
versioningOptional[ | When using the Worker Versioning feature, specifies whether this Workflow should Continue-as-New onto a worker with a compatible Build Id or not. |
Returns | |
NoReturn | Never returns, always raises a ContinueAsNewError . |
Raises | |
ContinueAsNewError | Always raised by this function. Should not be caught but instead be allowed to |
Info for the current update if any.
This is powered by contextvars
so it is only valid within the
update handler and coroutines/tasks it has started.
Warning
This API is experimental
Returns | |
Optional[ |
|
@overload
Optional[ str]
= None, sandboxed: bool
= True, failure_exception_types: Sequence[ Type[ BaseException]]
= []) -> Callable[ [ ClassType], ClassType]
:(source) ¶
Decorator for workflow classes.
This must be set on any registered workflow class (it is ignored if on a base class).
Parameters | |
cls:Optional[ | The class to decorate. |
name:Optional[ | Name to use for the workflow. Defaults to class __name__. This cannot be set if dynamic is set. |
sandboxed:bool | Whether the workflow should run in a sandbox. Default is true. |
dynamic:bool | If true, this activity will be dynamic. Dynamic workflows have to accept a single 'Sequence[RawValue]' parameter. This cannot be set to true if name is present. |
failureSequence[ | The types of exceptions that, if a workflow-thrown exception extends, will cause the workflow/update to fail instead of suspending the workflow via task failure. These are applied in addition to ones set on the worker constructor. If Exception is set, it effectively will fail a workflow/update in all user exception cases. WARNING: This setting is experimental. |
Mark a patch as deprecated.
This marks a workflow that had patched
in a previous version of
the code as no longer applicable because all workflows that use the old code
path are done and will never be queried again. Therefore the old code path
is removed as well.
Parameters | |
id:str | The identifier originally used with patched . |
CallableAsyncNoParam[ ReturnType]
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:CallableSyncNoParam[ ReturnType]
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:CallableAsyncSingleParam[ ParamType, ReturnType]
, arg: ParamType
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:CallableSyncSingleParam[ ParamType, ReturnType]
, arg: ParamType
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:Callable[ ..., Awaitable[ ReturnType]]
, *, args: Sequence[ Any]
, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:Callable[ ..., ReturnType]
, *, args: Sequence[ Any]
, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:str
, arg: Any
= temporalio.common._arg_unset, *, args: Sequence[ Any]
= [], task_queue: Optional[ str]
= None, result_type: Optional[ Type]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> Any
:Start an activity and wait for completion.
This is a shortcut for await start_activity
.
Type[ CallableAsyncNoParam[ ReturnType]]
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:Type[ CallableSyncNoParam[ ReturnType]]
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:Type[ CallableAsyncSingleParam[ ParamType, ReturnType]]
, arg: ParamType
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:Type[ CallableSyncSingleParam[ ParamType, ReturnType]]
, arg: ParamType
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:Type[ Callable[ ..., Awaitable[ ReturnType]]]
, *, args: Sequence[ Any]
, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:Type[ Callable[ ..., ReturnType]]
, *, args: Sequence[ Any]
, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:Start an activity from a callable class and wait for completion.
This is a shortcut for await start_activity_class
.
MethodAsyncNoParam[ SelfType, ReturnType]
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:MethodSyncNoParam[ SelfType, ReturnType]
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:MethodAsyncSingleParam[ SelfType, ParamType, ReturnType]
, arg: ParamType
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:MethodSyncSingleParam[ SelfType, ParamType, ReturnType]
, arg: ParamType
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:Callable[ Concatenate[ SelfType, MultiParamSpec], Awaitable[ ReturnType]]
, *, args: Sequence[ Any]
, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:Callable[ Concatenate[ SelfType, MultiParamSpec], ReturnType]
, *, args: Sequence[ Any]
, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:Start an activity from a method and wait for completion.
This is a shortcut for await start_activity_method
.
MethodAsyncNoParam[ SelfType, ReturnType]
, *, id: Optional[ str]
= None, task_queue: Optional[ str]
= None, cancellation_type: ChildWorkflowCancellationType
= ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED, parent_close_policy: ParentClosePolicy
= ParentClosePolicy.TERMINATE, 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, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cron_schedule: str
= '', memo: Optional[ Mapping[ str, Any]]
= None, search_attributes: Optional[ Union[ temporalio.common.SearchAttributes, temporalio.common.TypedSearchAttributes]]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:MethodAsyncSingleParam[ SelfType, ParamType, ReturnType]
, arg: ParamType
, *, id: Optional[ str]
= None, task_queue: Optional[ str]
= None, cancellation_type: ChildWorkflowCancellationType
= ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED, parent_close_policy: ParentClosePolicy
= ParentClosePolicy.TERMINATE, 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, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cron_schedule: str
= '', memo: Optional[ Mapping[ str, Any]]
= None, search_attributes: Optional[ Union[ temporalio.common.SearchAttributes, temporalio.common.TypedSearchAttributes]]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:Callable[ Concatenate[ SelfType, MultiParamSpec], Awaitable[ ReturnType]]
, *, args: Sequence[ Any]
, id: Optional[ str]
= None, task_queue: Optional[ str]
= None, cancellation_type: ChildWorkflowCancellationType
= ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED, parent_close_policy: ParentClosePolicy
= ParentClosePolicy.TERMINATE, 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, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cron_schedule: str
= '', memo: Optional[ Mapping[ str, Any]]
= None, search_attributes: Optional[ Union[ temporalio.common.SearchAttributes, temporalio.common.TypedSearchAttributes]]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ReturnType
:str
, arg: Any
= temporalio.common._arg_unset, *, args: Sequence[ Any]
= [], id: Optional[ str]
= None, task_queue: Optional[ str]
= None, result_type: Optional[ Type]
= None, cancellation_type: ChildWorkflowCancellationType
= ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED, parent_close_policy: ParentClosePolicy
= ParentClosePolicy.TERMINATE, 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, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cron_schedule: str
= '', memo: Optional[ Mapping[ str, Any]]
= None, search_attributes: Optional[ Union[ temporalio.common.SearchAttributes, temporalio.common.TypedSearchAttributes]]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> Any
:Start a child workflow and wait for completion.
This is a shortcut for await (await start_child_workflow
).
CallableAsyncNoParam[ ReturnType]
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:CallableSyncNoParam[ ReturnType]
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:CallableAsyncSingleParam[ ParamType, ReturnType]
, arg: ParamType
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:CallableSyncSingleParam[ ParamType, ReturnType]
, arg: ParamType
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:Callable[ ..., Awaitable[ ReturnType]]
, *, args: Sequence[ Any]
, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:Callable[ ..., ReturnType]
, *, args: Sequence[ Any]
, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:str
, arg: Any
= temporalio.common._arg_unset, *, args: Sequence[ Any]
= [], result_type: Optional[ Type]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> Any
:Start a local activity and wait for completion.
This is a shortcut for await start_local_activity
.
Warning
Local activities are currently experimental.
Type[ CallableAsyncNoParam[ ReturnType]]
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:Type[ CallableSyncNoParam[ ReturnType]]
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:Type[ CallableAsyncSingleParam[ ParamType, ReturnType]]
, arg: ParamType
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:Type[ CallableSyncSingleParam[ ParamType, ReturnType]]
, arg: ParamType
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:Type[ Callable[ ..., Awaitable[ ReturnType]]]
, *, args: Sequence[ Any]
, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:Type[ Callable[ ..., ReturnType]]
, *, args: Sequence[ Any]
, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:Start a local activity from a callable class and wait for completion.
This is a shortcut for await start_local_activity_class
.
Warning
Local activities are currently experimental.
MethodAsyncNoParam[ SelfType, ReturnType]
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:MethodSyncNoParam[ SelfType, ReturnType]
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:MethodAsyncSingleParam[ SelfType, ParamType, ReturnType]
, arg: ParamType
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:MethodSyncSingleParam[ SelfType, ParamType, ReturnType]
, arg: ParamType
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:Callable[ Concatenate[ SelfType, MultiParamSpec], Awaitable[ ReturnType]]
, *, args: Sequence[ Any]
, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:Callable[ Concatenate[ SelfType, MultiParamSpec], ReturnType]
, *, args: Sequence[ Any]
, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ReturnType
:Start a local activity from a method and wait for completion.
This is a shortcut for await start_local_activity_method
.
Warning
Local activities are currently experimental.
Get the current details of the workflow which may appear in the UI/CLI. Unlike static details set at start, this value can be updated throughout the life of the workflow and is independent of the static details. This can be in Temporal markdown format and can span multiple lines.
str
, *, run_id: Optional[ str]
= None) -> ExternalWorkflowHandle[ Any]
:
(source)
¶
Get a workflow handle to an existing workflow by its ID.
Parameters | |
workflowstr | Workflow ID to get a handle to. |
runOptional[ | Optional run ID for the workflow. |
Returns | |
ExternalWorkflowHandle[ | The external workflow handle. |
Union[ MethodAsyncNoParam[ SelfType, Any], MethodAsyncSingleParam[ SelfType, Any, Any]]
, workflow_id: str
, *, run_id: Optional[ str]
= None) -> ExternalWorkflowHandle[ SelfType]
:
(source)
¶
Get a typed workflow handle to an existing workflow by its ID.
This is the same as get_external_workflow_handle
but typed. Note,
the workflow type given is not validated, it is only for typing.
Parameters | |
workflow:Union[ | The workflow run method to use for typing the handle. |
workflowstr | Workflow ID to get a handle to. |
runOptional[ | Optional run ID for the workflow. |
Returns | |
ExternalWorkflowHandle[ | The external workflow handle. |
Get the query handler for the given name if any.
This includes handlers created via the @workflow.query decorator.
Parameters | |
name:str | Name of the query. |
Returns | |
Optional[ | Callable for the query if any. If a handler is not found for the name, this will not return the dynamic handler even if there is one. |
Get the signal handler for the given name if any.
This includes handlers created via the @workflow.signal decorator.
Parameters | |
name:str | Name of the signal. |
Returns | |
Optional[ | Callable for the signal if any. If a handler is not found for the name, this will not return the dynamic handler even if there is one. |
Get the update handler for the given name if any.
This includes handlers created via the @workflow.update decorator.
Parameters | |
name:str | Name of the update. |
Returns | |
Optional[ | Callable for the update if any. If a handler is not found for the name, this will not return the dynamic handler even if there is one. |
Decorator for the workflow init method.
This may be used on the __init__ method of the workflow class to specify that it accepts the same workflow input arguments as the @workflow.run method. If used, the parameters of your __init__ and @workflow.run methods must be identical.
Parameters | |
initCallableType | The __init__ method to decorate. |
Returns | |
CallableType | Undocumented |
Current workflow's memo values, converted without type hints.
Since type hints are not used, the default converted values will come back.
For example, if the memo was originally created with a dataclass, the value
will be a dict. To convert using proper type hints, use
memo_value
.
Returns | |
Mapping[ | Mapping of all memo keys and they values without type hints. |
@overload
@overload
str
, default: AnyType
, *, type_hint: Type[ ParamType]
) -> Union[ AnyType, ParamType]
:Memo value for the given key, optional default, and optional type hint.
Parameters | |
key:str | Key to get memo value for. |
default:Any | Default to use if key is not present. If unset, a
KeyError is raised when the key does not exist. |
typeOptional[ | Type hint to use when converting. |
Returns | |
Any | Memo value, converted with the type hint if present. |
Raises | |
KeyError | Key not present and default not set. |
Get the metric meter for the current workflow.
This meter is replay safe which means that metrics will not be recorded during replay.
Returns | |
temporalio.common.MetricMeter | Current metric meter for this workflow for recording metrics. |
Current time from the workflow perspective.
This is the workflow equivalent of datetime.now
with the
timezone.utc
parameter.
Returns | |
datetime | UTC datetime for the current workflow time. The datetime does have UTC set as the time zone. |
Patch a workflow.
When called, this will only return true if code should take the newer path which means this is either not replaying or is replaying and has seen this patch before.
Use deprecate_patch
when all workflows are done and will never be
queried again. The old code path can be used at that time too.
Parameters | |
id:str | The identifier for this patch. This identifier may be used repeatedly in the same workflow to represent the same patch |
Returns | |
bool | True if this should take the newer path, false if it should take the older path. |
Get the payload converter for the current workflow.
This is often used for dynamic workflows/signals/queries to convert payloads.
@overload
str
, description: Optional[ str]
= None) -> Callable[ [ CallableType], CallableType]
:Literal[ True]
, description: Optional[ str]
= None) -> Callable[ [ CallableType], CallableType]
:(source) ¶
Decorator for a workflow query method.
This is used on any non-async method that expects to handle a query. If a function overrides one with this decorator, it too must be decorated.
Query methods can only have positional parameters. Best practice for non-dynamic query methods is to only take a single object/dataclass argument that can accept more fields later if needed. The return value is the resulting query value. Query methods must not mutate any workflow state.
Parameters | |
fn:Optional[ | The function to decorate. |
name:Optional[ | Query name. Defaults to method __name__. Cannot be present when dynamic is present. |
dynamic:Optional[ | If true, this handles all queries not otherwise handled. The parameters of the method should be self, a string name, and a Sequence[RawValue]. An older form of this accepted vararg parameters which will now warn. Cannot be present when name is present. |
description:Optional[ | A short description of the query that may appear in the UI/CLI. |
Get a deterministic pseudo-random number generator.
Note, this random number generator is not cryptographically safe and should not be used for security purposes.
Returns | |
Random | The deterministically-seeded pseudo-random number generator. |
Decorator for the workflow run method.
This must be used on one and only one async method defined on the same class as @workflow.defn. This can be defined on a base class method but must then be explicitly overridden and defined on the workflow class.
Run methods can only have positional parameters. Best practice is to only take a single object/dataclass argument that can accept more fields later if needed.
Parameters | |
fn:CallableAsyncType | The function to decorate. |
Returns | |
CallableAsyncType | Undocumented |
Set the current details of the workflow which may appear in the UI/CLI. Unlike static details set at start, this value can be updated throughout the life of the workflow and is independent of the static details. This can be in Temporal markdown format and can span multiple lines.
Set or unset the signal handler for the given name.
This overrides any existing handlers for the given name, including handlers created via the @workflow.signal decorator.
When set, all unhandled past signals for the given name are immediately sent to the handler.
Parameters | |
name:str | Name of the signal. |
handler:Optional[ | Callable to set or None to unset. |
str
, handler: Optional[ Callable]
, *, validator: Optional[ Callable]
= None):
(source)
¶
Set or unset the update handler for the given name.
This overrides any existing handlers for the given name, including handlers created via the @workflow.update decorator.
Parameters | |
name:str | Name of the update. |
handler:Optional[ | Callable to set or None to unset. |
validator:Optional[ | Callable to set or None to unset as the update validator. |
@overload
HandlerUnfinishedPolicy
= HandlerUnfinishedPolicy.WARN_AND_ABANDON, description: Optional[ str]
= None) -> Callable[ [ CallableSyncOrAsyncReturnNoneType], CallableSyncOrAsyncReturnNoneType]
:str
, unfinished_policy: HandlerUnfinishedPolicy
= HandlerUnfinishedPolicy.WARN_AND_ABANDON, description: Optional[ str]
= None) -> Callable[ [ CallableSyncOrAsyncReturnNoneType], CallableSyncOrAsyncReturnNoneType]
:Literal[ True]
, unfinished_policy: HandlerUnfinishedPolicy
= HandlerUnfinishedPolicy.WARN_AND_ABANDON, description: Optional[ str]
= None) -> Callable[ [ CallableSyncOrAsyncReturnNoneType], CallableSyncOrAsyncReturnNoneType]
:Decorator for a workflow signal method.
This is used on any async or non-async method that you wish to be called upon receiving a signal. If a function overrides one with this decorator, it too must be decorated.
Signal methods can only have positional parameters. Best practice for non-dynamic signal methods is to only take a single object/dataclass argument that can accept more fields later if needed. Return values from signal methods are ignored.
Parameters | |
fn:Optional[ | The function to decorate. |
name:Optional[ | Signal name. Defaults to method __name__. Cannot be present when dynamic is present. |
dynamic:Optional[ | If true, this handles all signals not otherwise handled. The parameters of the method must be self, a string name, and a *args positional varargs. Cannot be present when name is present. |
unfinishedHandlerUnfinishedPolicy | Actions taken if a workflow terminates with a running instance of this handler. |
description:Optional[ | A short description of the signal that may appear in the UI/CLI. |
CallableAsyncNoParam[ ReturnType]
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None) -> ActivityHandle[ ReturnType]
:CallableSyncNoParam[ ReturnType]
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None) -> ActivityHandle[ ReturnType]
:CallableAsyncSingleParam[ ParamType, ReturnType]
, arg: ParamType
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None) -> ActivityHandle[ ReturnType]
:CallableSyncSingleParam[ ParamType, ReturnType]
, arg: ParamType
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None) -> ActivityHandle[ ReturnType]
:Callable[ ..., Awaitable[ ReturnType]]
, *, args: Sequence[ Any]
, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None) -> ActivityHandle[ ReturnType]
:Callable[ ..., ReturnType]
, *, args: Sequence[ Any]
, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None) -> ActivityHandle[ ReturnType]
:str
, arg: Any
= temporalio.common._arg_unset, *, args: Sequence[ Any]
= [], task_queue: Optional[ str]
= None, result_type: Optional[ Type]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None) -> ActivityHandle[ Any]
:Start an activity and return its handle.
At least one of schedule_to_close_timeout or start_to_close_timeout must be present.
Parameters | |
activity:Any | Activity name or function reference. |
arg:Any | Single argument to the activity. |
args:Sequence[ | Multiple arguments to the activity. Cannot be set if arg is. |
taskOptional[ | Task queue to run the activity on. Defaults to the current workflow's task queue. |
resultOptional[ | For string activities, this can set the specific result type hint to deserialize into. |
scheduleOptional[ | Max amount of time the activity can take from first being scheduled to being completed before it times out. This is inclusive of all retries. |
scheduleOptional[ | Max amount of time the activity can take to be started from first being scheduled. |
startOptional[ | Max amount of time a single activity run can take from when it starts to when it completes. This is per retry. |
heartbeatOptional[ | How frequently an activity must invoke heartbeat while running before it is considered timed out. |
retryOptional[ | How an activity is retried on failure. If unset, a server-defined default is used. Set maximum attempts to 1 to disable retries. |
cancellationActivityCancellationType | How the activity is treated when it is cancelled from the workflow. |
activityOptional[ | Optional unique identifier for the activity. This is an advanced setting that should not be set unless users are sure they need to. Contact Temporal before setting this value. |
versioningOptional[ | When using the Worker Versioning feature, specifies whether this Activity should run on a worker with a compatible Build Id or not. |
summary:Optional[ | A single-line fixed summary for this activity that may appear in UI/CLI. This can be in single-line Temporal markdown format. |
Returns | |
ActivityHandle[ | An activity handle to the activity which is an async task. |
Type[ CallableAsyncNoParam[ ReturnType]]
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Type[ CallableSyncNoParam[ ReturnType]]
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Type[ CallableAsyncSingleParam[ ParamType, ReturnType]]
, arg: ParamType
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Type[ CallableSyncSingleParam[ ParamType, ReturnType]]
, arg: ParamType
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Type[ Callable[ ..., Awaitable[ ReturnType]]]
, *, args: Sequence[ Any]
, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Type[ Callable[ ..., ReturnType]]
, *, args: Sequence[ Any]
, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Start an activity from a callable class.
See start_activity
for parameter and return details.
MethodAsyncNoParam[ SelfType, ReturnType]
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:MethodSyncNoParam[ SelfType, ReturnType]
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:MethodAsyncSingleParam[ SelfType, ParamType, ReturnType]
, arg: ParamType
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:MethodSyncSingleParam[ SelfType, ParamType, ReturnType]
, arg: ParamType
, *, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Callable[ Concatenate[ SelfType, MultiParamSpec], Awaitable[ ReturnType]]
, *, args: Sequence[ Any]
, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Callable[ Concatenate[ SelfType, MultiParamSpec], ReturnType]
, *, args: Sequence[ Any]
, task_queue: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, heartbeat_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None, versioning_intent: Optional[ VersioningIntent]
= None, summary: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Start an activity from a method.
See start_activity
for parameter and return details.
MethodAsyncNoParam[ SelfType, ReturnType]
, *, id: Optional[ str]
= None, task_queue: Optional[ str]
= None, cancellation_type: ChildWorkflowCancellationType
= ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED, parent_close_policy: ParentClosePolicy
= ParentClosePolicy.TERMINATE, 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, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cron_schedule: str
= '', memo: Optional[ Mapping[ str, Any]]
= None, search_attributes: Optional[ Union[ temporalio.common.SearchAttributes, temporalio.common.TypedSearchAttributes]]
= None, versioning_intent: Optional[ VersioningIntent]
= None, static_summary: Optional[ str]
= None, static_details: Optional[ str]
= None) -> ChildWorkflowHandle[ SelfType, ReturnType]
:MethodAsyncSingleParam[ SelfType, ParamType, ReturnType]
, arg: ParamType
, *, id: Optional[ str]
= None, task_queue: Optional[ str]
= None, cancellation_type: ChildWorkflowCancellationType
= ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED, parent_close_policy: ParentClosePolicy
= ParentClosePolicy.TERMINATE, 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, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cron_schedule: str
= '', memo: Optional[ Mapping[ str, Any]]
= None, search_attributes: Optional[ Union[ temporalio.common.SearchAttributes, temporalio.common.TypedSearchAttributes]]
= None, versioning_intent: Optional[ VersioningIntent]
= None, static_summary: Optional[ str]
= None, static_details: Optional[ str]
= None) -> ChildWorkflowHandle[ SelfType, ReturnType]
:Callable[ Concatenate[ SelfType, MultiParamSpec], Awaitable[ ReturnType]]
, *, args: Sequence[ Any]
, id: Optional[ str]
= None, task_queue: Optional[ str]
= None, cancellation_type: ChildWorkflowCancellationType
= ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED, parent_close_policy: ParentClosePolicy
= ParentClosePolicy.TERMINATE, 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, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cron_schedule: str
= '', memo: Optional[ Mapping[ str, Any]]
= None, search_attributes: Optional[ Union[ temporalio.common.SearchAttributes, temporalio.common.TypedSearchAttributes]]
= None, versioning_intent: Optional[ VersioningIntent]
= None, static_summary: Optional[ str]
= None, static_details: Optional[ str]
= None) -> ChildWorkflowHandle[ SelfType, ReturnType]
:str
, arg: Any
= temporalio.common._arg_unset, *, args: Sequence[ Any]
= [], id: Optional[ str]
= None, task_queue: Optional[ str]
= None, result_type: Optional[ Type]
= None, cancellation_type: ChildWorkflowCancellationType
= ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED, parent_close_policy: ParentClosePolicy
= ParentClosePolicy.TERMINATE, 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, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, cron_schedule: str
= '', memo: Optional[ Mapping[ str, Any]]
= None, search_attributes: Optional[ Union[ temporalio.common.SearchAttributes, temporalio.common.TypedSearchAttributes]]
= None, versioning_intent: Optional[ VersioningIntent]
= None, static_summary: Optional[ str]
= None, static_details: Optional[ str]
= None) -> ChildWorkflowHandle[ Any, Any]
:Start a child workflow and return its handle.
Parameters | |
workflow:Any | String name or class method decorated with @workflow.run for the workflow to start. |
arg:Any | Single argument to the child workflow. |
args:Sequence[ | Multiple arguments to the child workflow. Cannot be set if arg is. |
id:Optional[ | Optional unique identifier for the workflow execution. If not set,
defaults to uuid4 . |
taskOptional[ | Task queue to run the workflow on. Defaults to the current workflow's task queue. |
resultOptional[ | For string workflows, this can set the specific result type hint to deserialize into. |
cancellationChildWorkflowCancellationType | How the child workflow will react to cancellation. |
parentParentClosePolicy | How to handle the child workflow when the parent workflow closes. |
executionOptional[ | Total workflow execution timeout including retries and continue as new. |
runOptional[ | Timeout of a single workflow run. |
taskOptional[ | Timeout of a single workflow task. |
idtemporalio.common.WorkflowIDReusePolicy | How already-existing IDs are treated. |
retryOptional[ | Retry policy for the workflow. |
cronstr | See https://docs.temporal.io/docs/content/what-is-a-temporal-cron-job/ |
memo:Optional[ | Memo for the workflow. |
searchOptional[ | Search attributes for the workflow. The dictionary form of this is DEPRECATED. |
versioningOptional[ | When using the Worker Versioning feature, specifies whether this Child Workflow should run on a worker with a compatible Build Id or not. |
staticOptional[ | A single-line fixed summary for this child workflow execution that may appear in the UI/CLI. This can be in single-line Temporal markdown format. |
staticOptional[ | General fixed details for this child 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 Workflow.get_current_details within the workflow. |
Returns | |
ChildWorkflowHandle[ | A workflow handle to the started/existing workflow. |
CallableAsyncNoParam[ ReturnType]
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:CallableSyncNoParam[ ReturnType]
, *, activity_id: Optional[ str]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL) -> ActivityHandle[ ReturnType]
:CallableAsyncSingleParam[ ParamType, ReturnType]
, arg: ParamType
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:CallableSyncSingleParam[ ParamType, ReturnType]
, arg: ParamType
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Callable[ ..., Awaitable[ ReturnType]]
, *, args: Sequence[ Any]
, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Callable[ ..., ReturnType]
, *, args: Sequence[ Any]
, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:str
, arg: Any
= temporalio.common._arg_unset, *, args: Sequence[ Any]
= [], result_type: Optional[ Type]
= None, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ Any]
:Start a local activity and return its handle.
At least one of schedule_to_close_timeout or start_to_close_timeout must be present.
Warning
Local activities are currently experimental.
Parameters | |
activity:Any | Activity name or function reference. |
arg:Any | Single argument to the activity. |
args:Sequence[ | Multiple arguments to the activity. Cannot be set if arg is. |
resultOptional[ | For string activities, this can set the specific result type hint to deserialize into. |
scheduleOptional[ | Max amount of time the activity can take from first being scheduled to being completed before it times out. This is inclusive of all retries. |
scheduleOptional[ | Max amount of time the activity can take to be started from first being scheduled. |
startOptional[ | Max amount of time a single activity run can take from when it starts to when it completes. This is per retry. |
retryOptional[ | How an activity is retried on failure. If unset, an SDK-defined default is used. Set maximum attempts to 1 to disable retries. |
localOptional[ | Undocumented |
cancellationActivityCancellationType | How the activity is treated when it is cancelled from the workflow. |
activityOptional[ | Optional unique identifier for the activity. This is an advanced setting that should not be set unless users are sure they need to. Contact Temporal before setting this value. |
Returns | |
ActivityHandle[ | An activity handle to the activity which is an async task. |
Type[ CallableAsyncNoParam[ ReturnType]]
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Type[ CallableSyncNoParam[ ReturnType]]
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Type[ CallableAsyncSingleParam[ ParamType, ReturnType]]
, arg: ParamType
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Type[ CallableSyncSingleParam[ ParamType, ReturnType]]
, arg: ParamType
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Type[ Callable[ ..., Awaitable[ ReturnType]]]
, *, args: Sequence[ Any]
, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Type[ Callable[ ..., ReturnType]]
, *, args: Sequence[ Any]
, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Start a local activity from a callable class.
See start_local_activity
for parameter and return details.
Warning
Local activities are currently experimental.
MethodAsyncNoParam[ SelfType, ReturnType]
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:MethodSyncNoParam[ SelfType, ReturnType]
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:MethodAsyncSingleParam[ SelfType, ParamType, ReturnType]
, arg: ParamType
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:MethodSyncSingleParam[ SelfType, ParamType, ReturnType]
, arg: ParamType
, *, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Callable[ Concatenate[ SelfType, MultiParamSpec], Awaitable[ ReturnType]]
, *, args: Sequence[ Any]
, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Callable[ Concatenate[ SelfType, MultiParamSpec], ReturnType]
, *, args: Sequence[ Any]
, schedule_to_close_timeout: Optional[ timedelta]
= None, schedule_to_start_timeout: Optional[ timedelta]
= None, start_to_close_timeout: Optional[ timedelta]
= None, retry_policy: Optional[ temporalio.common.RetryPolicy]
= None, local_retry_threshold: Optional[ timedelta]
= None, cancellation_type: ActivityCancellationType
= ActivityCancellationType.TRY_CANCEL, activity_id: Optional[ str]
= None) -> ActivityHandle[ ReturnType]
:Start a local activity from a method.
See start_local_activity
for parameter and return details.
Warning
Local activities are currently experimental.
Current nanoseconds since the epoch from the workflow perspective.
This is the workflow equivalent of time.time_ns
.
Returns | |
int | Nanoseconds since the epoch |
Callable[ MultiParamSpec, Awaitable[ ReturnType]]
) -> UpdateMethodMultiParam[ MultiParamSpec, ReturnType]
:Callable[ MultiParamSpec, ReturnType]
) -> UpdateMethodMultiParam[ MultiParamSpec, ReturnType]
:HandlerUnfinishedPolicy
= HandlerUnfinishedPolicy.WARN_AND_ABANDON, description: Optional[ str]
= None) -> Callable[ [ Callable[ MultiParamSpec, ReturnType]], UpdateMethodMultiParam[ MultiParamSpec, ReturnType]]
:str
, unfinished_policy: HandlerUnfinishedPolicy
= HandlerUnfinishedPolicy.WARN_AND_ABANDON, description: Optional[ str]
= None) -> Callable[ [ Callable[ MultiParamSpec, ReturnType]], UpdateMethodMultiParam[ MultiParamSpec, ReturnType]]
:Literal[ True]
, unfinished_policy: HandlerUnfinishedPolicy
= HandlerUnfinishedPolicy.WARN_AND_ABANDON, description: Optional[ str]
= None) -> Callable[ [ Callable[ MultiParamSpec, ReturnType]], UpdateMethodMultiParam[ MultiParamSpec, ReturnType]]
:Decorator for a workflow update handler method.
This is used on any async or non-async method that you wish to be called upon receiving an update. If a function overrides one with this decorator, it too must be decorated.
You may also optionally define a validator method that will be called before this handler you have applied this decorator to. You can specify the validator with @update_handler_function_name.validator.
Update methods can only have positional parameters. Best practice for non-dynamic update methods is to only take a single object/dataclass argument that can accept more fields later if needed. The handler may return a serializable value which will be sent back to the caller of the update.
Warning
This API is experimental
Parameters | |
fn:Optional[ | The function to decorate. |
name:Optional[ | Update name. Defaults to method __name__. Cannot be present when dynamic is present. |
dynamic:Optional[ | If true, this handles all updates not otherwise handled. The parameters of the method must be self, a string name, and a *args positional varargs. Cannot be present when name is present. |
unfinishedHandlerUnfinishedPolicy | Actions taken if a workflow terminates with a running instance of this handler. |
description:Optional[ | A short description of the update that may appear in the UI/CLI. |
Union[ temporalio.common.SearchAttributes, Sequence[ temporalio.common.SearchAttributeUpdate]]
):
(source)
¶
Upsert search attributes for this workflow.
Parameters | |
attributes:Union[ | The attributes to set. This should be a sequence of updates (i.e. values created via value_set and value_unset calls on search attribute keys). The dictionary form of attributes is DEPRECATED and if used, result in invalid key types on the typed_search_attributes property in the info. |
Iterable[ _FT]
, *, timeout: Optional[ float]
= None, return_when: str
= asyncio.ALL_COMPLETED) -> Tuple[ List[ _FT], List[ _FT]]
:Iterable[ asyncio.Task[ AnyType]]
, *, timeout: Optional[ float]
= None, return_when: str
= asyncio.ALL_COMPLETED) -> Tuple[ List[ asyncio.Task[ AnyType]], set[ asyncio.Task[ AnyType]]]
:Wait for the Futures or Tasks given by fs to complete.
This is a deterministic version of asyncio.wait
. This function
should be used instead of that one in workflows.
Callable[ [], bool]
, *, timeout: Optional[ Union[ timedelta, float]]
= None, timeout_summary: Optional[ str]
= None):
(source)
¶
Wait on a callback to become true.
This function returns when the callback returns true (invoked each loop iteration) or the timeout has been reached.
Parameters | |
fn:Callable[ | Non-async callback that accepts no parameters and returns a boolean. |
timeout:Optional[ | Optional number of seconds to wait until throwing
asyncio.TimeoutError . |
timeoutOptional[ | Optional simple string identifying the timer (created if timeout is present) that may be visible in UI/CLI. While it can be normal text, it is best to treat as a timer ID. |
Logger that will have contextual workflow details embedded.
Logs are skipped during replay by default.
Callable
, arg_types: Optional[ List[ Type]]
, is_method: bool
) -> bool
:
(source)
¶
Undocumented
_UpdateDefinition
, fn: Optional[ Callable[ ..., None]]
= None) -> Optional[ Callable[ ..., None]]
:
(source)
¶
Decorator for a workflow update validator method.
Iterable[ Union[ asyncio.Future, asyncio.Task]]
, timeout: Optional[ float]
, return_when: str
, loop: asyncio.AbstractEventLoop
) -> Tuple[ List, List]
:
(source)
¶
Undocumented