pynenc.invocation.conc_invocation¶
Module Contents¶
Classes¶
A synchronous implementation of a task invocation. |
|
A group of synchronous invocations for a specific task. |
API¶
- class pynenc.invocation.conc_invocation.ConcurrentInvocation(call: pynenc.call.Call[pynenc.types.Params, pynenc.types.Result])[source]¶
Bases:
pynenc.invocation.base_invocation.BaseInvocation[pynenc.types.Params,pynenc.types.Result]A synchronous implementation of a task invocation.
This class represents an invocation of a task in a synchronous context.
- Parameters:
call (Call[Params, Result]) – The specific call instance that this invocation represents.
Danger
Use only for testing purposes where distributed processing is not required.
Initialization
Initialize the invocation with its identity.
- property status: pynenc.invocation.status.InvocationStatus¶
Get the status of the invocation.
- Returns:
The current status of the invocation.
- Return type:
- result() pynenc.types.Result¶
Execute the task call and return its result.
This method runs the task synchronously and returns the result. It handles retries for retriable exceptions as per the task’s configuration.
- Returns:
The result of the task execution.
- Return type:
Result
- Raises:
Exception – Raised if the task execution results in an unhandled exception.
- property num_retries: int¶
Get the number of retries for the invocation.
- Returns:
The number of times the invocation has been retried.
- Return type:
- classmethod from_json(app: pynenc.app.Pynenc, serialized: str) pynenc.invocation.conc_invocation.ConcurrentInvocation[source]¶
- class pynenc.invocation.conc_invocation.ConcurrentInvocationGroup[source]¶
Bases:
pynenc.invocation.base_invocation.BaseInvocationGroup[pynenc.types.Params,pynenc.types.Result,pynenc.invocation.conc_invocation.ConcurrentInvocation]A group of synchronous invocations for a specific task.
This class extends
BaseInvocationGroupto handle groups ofConcurrentInvocationinstances. It is designed for scenarios where multiple synchronous invocations of a task are managed or processed together.- Parameters:
task (Task) – The task associated with these invocations.
invocations (list[ConcurrentInvocation]) – A list of synchronous invocations.
Danger
Use only for testing purposes where distributed processing is not required.
- property results: collections.abc.Iterator[pynenc.types.Result]¶
An iterator over the results of the invocations in the group.
This property method iterates over the
ConcurrentInvocationinstances in the group, yielding the result of each invocation.- Returns:
An iterator over the results of each invocation in the group.
- Return type:
Iterator[Result]
- async async_results() collections.abc.AsyncGenerator[pynenc.types.Result, None][source]¶
An async iterator over the results of the invocations in the group.
This method asynchronously iterates over the
ConcurrentInvocationinstances, yielding the result of each invocation using their async_result method.- Returns:
An async iterator over the results of each invocation in the group.
- Return type:
AsyncIterator[Result]