pynenc.invocation.base_invocation¶
Module Contents¶
Classes¶
Base class for representing an invocation of a task call in a distributed system. |
|
Abstract base class for grouping multiple invocations of a specific task. |
Data¶
API¶
- pynenc.invocation.base_invocation.T¶
‘TypeVar(…)’
- class pynenc.invocation.base_invocation.BaseInvocation[source]¶
Bases:
abc.ABC,typing.Generic[pynenc.types.Params,pynenc.types.Result]Base class for representing an invocation of a task call in a distributed system.
In the context of the system, the following concepts are key:
Function: A standard Python function.
Task: A Pynenc object encapsulating a function, enabling it to run in a distributed environment. Tasks are unique by module and function name and cannot be nested.
Call: A specific call to a task with a set of arguments, unique per function and argument set.
Invocation: A specific execution instance of a call.
A single task can be called with different arguments, and each call can be executed multiple times. This distinction is crucial for orchestration and cycle control within the system.
The
BaseInvocationclass serves as a template for two key types of invocations:DistributedInvocation: The primary invocation type used in the system for distributed execution.SynchronousInvocation: Used for local execution, primarily in testing environments without a runner.
Important
Sync invocations cannot be used in production environments, only for testing in sync mode.
- Parameters:
call (Call[Params, Result]) – The specific call instance that this invocation represents.
- call: pynenc.call.Call[pynenc.types.Params, pynenc.types.Result]¶
None
- property app: pynenc.app.Pynenc¶
- property task: pynenc.task.Task[pynenc.types.Params, pynenc.types.Result]¶
- property arguments: pynenc.arguments.Arguments¶
- abstract classmethod from_json(app: pynenc.app.Pynenc, serialized: str) pynenc.invocation.base_invocation.T[source]¶
- Returns:
a new invocation from a serialized invocation
- invocation_id() str¶
- Returns:
a unique id for this invocation
A task with the same arguments can have multiple invocations, the invocation id is used to differentiate them
- abstract property status: pynenc.invocation.status.InvocationStatus¶
- abstract property result: pynenc.types.Result¶
- class pynenc.invocation.base_invocation.BaseInvocationGroup[source]¶
Bases:
abc.ABC,typing.Generic[pynenc.types.Params,pynenc.types.Result,pynenc.invocation.base_invocation.T]Abstract base class for grouping multiple invocations of a specific task.
This class is designed to aggregate a collection of invocations, each represented by a
BaseInvocationor its subclasses. It is useful in scenarios where multiple invocations of a task need to be managed or processed together.Subclasses of
BaseInvocationGroup, such asSynchronousInvocationGroupandDistributedInvocationGroup, provide specific implementations for synchronous and distributed environments, respectively.- Parameters:
task (Task) – The task associated with the invocations.
invocations (list[BaseInvocation]) – A list of invocations, each an instance of a
BaseInvocationsubclass.
- task: pynenc.task.Task¶
None
- property app: pynenc.app.Pynenc¶