class documentation

Runtime for Temporal Python SDK.

Most users are encouraged to use default. It can be set with set_default. Every time a new runtime is created, a new internal thread pool is created.

Runtimes do not work across forks. Advanced users should consider using prevent_default and :py:meth`set_default to ensure each fork creates it's own runtime.

Class Method default Get the default runtime, creating if not already created. If prevent_default is called before this method it will raise a RuntimeError instead of creating a default runtime.
Class Method prevent_default Prevent default from lazily creating a Runtime.
Static Method set_default Set the default runtime to the given runtime.
Method __init__ Create a runtime with the provided configuration.
Property metric_meter Metric meter for this runtime. This is a no-op metric meter if no metrics were configured.
Instance Variable _core_runtime Undocumented
Instance Variable _metric_meter Undocumented
@classmethod
def default(cls) -> Runtime: (source)

Get the default runtime, creating if not already created. If prevent_default is called before this method it will raise a RuntimeError instead of creating a default runtime.

If the default runtime needs to be different, it should be done with set_default before this is called or ever used.

Returns
RuntimeThe default runtime.
@classmethod
def prevent_default(cls): (source)

Prevent default from lazily creating a Runtime.

Raises a RuntimeError if a default Runtime has already been created.

Explicitly setting a default runtime with set_default bypasses this setting and future calls to default will return the provided runtime.

@staticmethod
def set_default(runtime: Runtime, *, error_if_already_set: bool = True): (source)

Set the default runtime to the given runtime.

This should be called before any Temporal client is created, but can change the existing one. Any clients and workers created with the previous runtime will stay on that runtime.

Parameters
runtime:RuntimeThe runtime to set.
error_if_already_set:boolIf True and default is already set, this will raise a RuntimeError.
def __init__(self, *, telemetry: TelemetryConfig, worker_heartbeat_interval: timedelta | None = timedelta(seconds=60)): (source)

Create a runtime with the provided configuration.

Each new runtime creates a new internal thread pool, so use sparingly.

Parameters
telemetry:TelemetryConfigTelemetry configuration when not supplying runtime_options.
worker_heartbeat_interval:timedelta | NoneInterval for worker heartbeats. None disables heartbeating. Interval must be between 1s and 60s.
Raises
ValueErrorIf both `runtime_options is a negative value.

Metric meter for this runtime. This is a no-op metric meter if no metrics were configured.

_core_runtime = (source)

Undocumented

_metric_meter = (source)

Undocumented