module documentation

Undocumented

Class DynamicWorkflowConfig Returned by functions using the dynamic_config decorator, see it for more.
Function defn Decorator for workflow classes.
Function dynamic_config Decorator to allow configuring a dynamic workflow's behavior.
Function init Decorator for the workflow init method.
Function run Decorator for the workflow run method.
def defn(cls: ClassType) -> ClassType:
def defn(*, name: str | None = None, sandboxed: bool = True, failure_exception_types: Sequence[type[BaseException]] = [], versioning_behavior: temporalio.common.VersioningBehavior = temporalio.common.VersioningBehavior.UNSPECIFIED) -> Callable[[ClassType], ClassType]:
def defn(*, sandboxed: bool = True, dynamic: bool = False, versioning_behavior: temporalio.common.VersioningBehavior = temporalio.common.VersioningBehavior.UNSPECIFIED) -> 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:ClassType | NoneThe class to decorate.
name:str | NoneName to use for the workflow. Defaults to class __name__. This cannot be set if dynamic is set.
sandboxed:boolWhether the workflow should run in a sandbox. Default is true.
dynamic:boolIf 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.
failure_exception_types:Sequence[type[BaseException]]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.
versioning_behavior:temporalio.common.VersioningBehaviorSpecifies the versioning behavior to use for this workflow.
Returns
Callable[[ClassType], ClassType]Undocumented
def dynamic_config(fn: MethodSyncNoParam[SelfType, DynamicWorkflowConfig]) -> MethodSyncNoParam[SelfType, DynamicWorkflowConfig]: (source)

Decorator to allow configuring a dynamic workflow's behavior.

Because dynamic workflows may conceptually represent more than one workflow type, it may be desirable to have different settings for fields that would normally be passed to defn, but vary based on the workflow type name or other information available in the workflow's context. This function will be called after the workflow's init, if it has one, but before the workflow's run method.

The method must only take self as a parameter, and any values set in the class it returns will override those provided to defn.

Cannot be specified on non-dynamic workflows.

Parameters
fn:MethodSyncNoParam[SelfType, DynamicWorkflowConfig]The function to decorate.
Returns
MethodSyncNoParam[SelfType, DynamicWorkflowConfig]Undocumented
def init(init_fn: CallableType) -> CallableType: (source)

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
init_fn:CallableTypeThe __init__ method to decorate.
Returns
CallableTypeUndocumented
def run(fn: CallableAsyncType) -> CallableAsyncType: (source)

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:CallableAsyncTypeThe function to decorate.
Returns
CallableAsyncTypeUndocumented