nat.runtime.runner#

Attributes#

Classes#

RunnerState

Lifecycle states for a workflow runner.

Runner

The Runner class is used to run a workflow. It handles converting input and output data types and running the

Module Contents#

logger#
class RunnerState(*args, \*\*kwds)#

Bases: enum.Enum

Lifecycle states for a workflow runner.

UNINITIALIZED = 0#
INITIALIZED = 1#
RUNNING = 2#
COMPLETED = 3#
FAILED = 4#
_T#
class Runner(
input_message: Any,
entry_fn: nat.builder.function.Function,
context_state: nat.builder.context.ContextState,
exporter_manager: nat.observability.exporter_manager.ExporterManager,
runtime_type: nat.data_models.runtime_enum.RuntimeTypeEnum = RuntimeTypeEnum.RUN_OR_SERVE,
saved_context: contextvars.Context | None = None,
)#

The Runner class is used to run a workflow. It handles converting input and output data types and running the workflow with the specified concurrency.

Parameters#

input_messagetyping.Any

The input message to the workflow

entry_fnFunction

The entry function to the workflow

context_stateContextState

The context state to use

exporter_managerExporterManager

The exporter manager to use

runtime_typeRuntimeTypeEnum

The runtime type (RUN_OR_SERVE, EVALUATE, OTHER)

saved_contextcontextvars.Context | None

The saved context from the workflow build phase to restore for each request

_entry_fn#
_context_state#
_context#
_state#
_input_message_token = None#
_input_message#
_exporter_manager#
_runtime_type#
_runtime_type_token = None#
_saved_context = None#
property context: nat.builder.context.Context#
convert(value: Any, to_type: type[_T]) _T#
async result() Any#
async result(to_type: type[_T]) _T
async result_stream(to_type: type | None = None)#