package documentation

Temporal Nexus support

Warning

Nexus APIs are experimental and unstable.

See https://github.com/temporalio/sdk-python/tree/main#nexus

Module _decorators Undocumented
Module _link_conversion No module docstring; 0/1 variable, 0/7 constant, 7/9 functions documented
Module _operation_context No module docstring; 0/3 variable, 0/1 type variable, 0/4 function, 2/3 classes documented
Module _operation_handlers No module docstring; 1/1 function, 1/1 class documented
Module _token Undocumented
Module _util No module docstring; 0/1 type variable, 5/6 functions documented

From __init__.py:

Class Info Information about the running Nexus operation.
Class LoggerAdapter Logger adapter that adds Nexus operation context information.
Class NexusCallback Nexus callback to attach to events such as workflow completion.
Class WorkflowHandle A handle to a workflow that is backing a Nexus operation.
Class WorkflowRunOperationContext Context received by a workflow run operation.
Function client Get the Temporal client used by the worker handling the current Nexus operation.
Function in_operation Whether the current code is inside a Nexus operation.
Function info Get the current Nexus operation information.
Function is_worker_shutdown Whether shutdown has been invoked on the worker.
Function metric_meter Get the metric meter for the current Nexus operation.
Async Function wait_for_worker_shutdown Asynchronously wait for shutdown to be called on the worker.
Function wait_for_worker_shutdown_sync Synchronously block while waiting for shutdown to be called on the worker.
Function workflow_run_operation Decorator marking a method as the start method for a workflow-backed operation.
Variable logger Logger that emits additional data describing the current Nexus operation.

Get the Temporal client used by the worker handling the current Nexus operation.

def in_operation() -> bool: (source)

Whether the current code is inside a Nexus operation.

def info() -> Info: (source)

Get the current Nexus operation information.

def is_worker_shutdown() -> bool: (source)

Whether shutdown has been invoked on the worker.

Returns
boolTrue if shutdown has been called on the worker, False otherwise.
Raises
RuntimeErrorWhen not in a Nexus operation.

Get the metric meter for the current Nexus operation.

async def wait_for_worker_shutdown(): (source)

Asynchronously wait for shutdown to be called on the worker.

Raises
RuntimeErrorWhen not in a Nexus operation.
def wait_for_worker_shutdown_sync(timeout: timedelta | float | None = None): (source)

Synchronously block while waiting for shutdown to be called on the worker.

This is essentially a wrapper around threading.Event.wait.

Parameters
timeout:timedelta | float | NoneMax amount of time to wait for shutdown to be called on the worker.
Raises
RuntimeErrorWhen not in a Nexus operation.
@overload
def workflow_run_operation(start: Callable[[ServiceHandlerT, WorkflowRunOperationContext, InputT], Awaitable[WorkflowHandle[OutputT]]]) -> Callable[[ServiceHandlerT, WorkflowRunOperationContext, InputT], Awaitable[WorkflowHandle[OutputT]]]:
@overload
def workflow_run_operation(*, name: str | None = None) -> Callable[[Callable[[ServiceHandlerT, WorkflowRunOperationContext, InputT], Awaitable[WorkflowHandle[OutputT]]]], Callable[[ServiceHandlerT, WorkflowRunOperationContext, InputT], Awaitable[WorkflowHandle[OutputT]]]]:
(source)

Decorator marking a method as the start method for a workflow-backed operation.

Logger that emits additional data describing the current Nexus operation.