pynenc.workflow.workflow_context¶
Module Contents¶
Classes¶
Provides workflow capabilities for tasks within Pynenc. |
|
Root-only workflow orchestration operations. |
|
Workflow context for workflow-defining tasks. |
Data¶
API¶
- pynenc.workflow.workflow_context.S¶
‘TypeVar(…)’
- class pynenc.workflow.workflow_context.WorkflowContext(task: pynenc.task.Task)[source]¶
Provides workflow capabilities for tasks within Pynenc.
This class exposes shared workflow state for any task that is running inside a workflow. Root-only orchestration lives on
WorkflowRootContext.root.- Parameters:
task – The task this helper is attached to
Initialization
Initialize the workflow helper with its associated task.
- property app: pynenc.app.Pynenc¶
Get the Pynenc app instance associated with this workflow.
- property identity: pynenc.workflow.workflow_identity.WorkflowIdentity¶
Get the workflow identity for the current execution.
- class pynenc.workflow.workflow_context.WorkflowRootOps(task: pynenc.task.Task)[source]¶
Root-only workflow orchestration operations.
The public
wf.rootboundary makes it explicit that these methods are only valid on the workflow-defining invocation. The deterministic replay cursor itself is stored on the active invocation object, not on the cached task-level workflow context.Initialization
- property _invocation: pynenc.invocation.dist_invocation.DistributedInvocation¶
- _ensure_root_workflow_operation_allowed(operation_name: str) pynenc.invocation.dist_invocation.DistributedInvocation[source]¶
- _deterministic(operation_name: str) pynenc.workflow.workflow_deterministic.DeterministicExecutor[source]¶
- random() float[source]¶
Generate a deterministic random number in the workflow context.
Returns the same sequence of “random” numbers on workflow replay.
- Returns:
A random float between 0.0 and 1.0
- utc_now() datetime.datetime[source]¶
Get the current time deterministically in the workflow context.
Returns deterministic timestamps that advance consistently on workflow replay.
- Returns:
Current datetime with UTC timezone
- uuid() str[source]¶
Generate a deterministic UUID in the workflow context.
Returns the same sequence of UUIDs on workflow replay.
- Returns:
UUID string
- execute_task(task: pynenc.task.Task, *args: Any, **kwargs: Any) Any[source]¶
Execute a task as part of this workflow with deterministic replay.
On workflow replay, returns the recorded result without re-execution.
- Parameters:
task – The task to execute
args – Positional arguments for the task
kwargs – Keyword arguments for the task
- Returns:
Task result
- class pynenc.workflow.workflow_context.WorkflowRootContext(task: pynenc.task.Task)[source]¶
Bases:
pynenc.workflow.workflow_context.WorkflowContextWorkflow context for workflow-defining tasks.
Initialization
Initialize the workflow helper with its associated task.