pynenc.call¶
Module Contents¶
Classes¶
Base class for task calls with common functionality. |
|
Represents a call optimized for parallel routing with pre-serialized arguments. This call type is used for batch processing tasks with disabled concurrency control, where some arguments are pre-serialized (e.g., large shared data). |
API¶
- class pynenc.call.Call[source]¶
Bases:
typing.Generic[pynenc.types.Params,pynenc.types.Result]Base class for task calls with common functionality.
- Parameters:
task (Task[Params, Result]) – The task associated with the call.
- _arguments: pynenc.arguments.Arguments¶
‘field(…)’
- property app: pynenc.app.Pynenc¶
Gets the Pynenc application instance associated with the task.
- Returns:
The Pynenc application instance.
- property arguments: pynenc.arguments.Arguments¶
Get the arguments for this call. This property allows subclasses to override argument handling.
- Returns:
Arguments object containing call arguments
- property call_id: str¶
Generates a unique identifier for the call based on the task ID and the arguments.
- Returns:
A string representing the unique identifier of the call.
- serialized_arguments() dict[str, str]¶
Serializes the call arguments into strings.
- Returns:
A dictionary of serialized argument strings.
- serialized_args_for_concurrency_check() dict[str, str] | None¶
Determines the call arguments required for the task concurrency check.
- Returns:
A dictionary of serialized argument strings required for concurrency control, or None if concurrency control is disabled.
- deserialize_arguments(serialized_arguments: dict[str, str]) pynenc.arguments.Arguments[source]¶
Deserializes the given serialized arguments.
- to_json() str[source]¶
Serializes the call into a JSON string.
- Returns:
A JSON string representing the serialized call.
- __getstate__() dict[source]¶
Gets the state of the Call object for serialization purposes.
- Returns:
A dictionary representing the state of the Call object.
- __setstate__(state: dict) None[source]¶
Sets the state of the Call object from the provided dictionary.
- Parameters:
state (dict) – A dictionary representing the state to set.
- classmethod from_json(app: pynenc.app.Pynenc, serialized: str) pynenc.call.Call[source]¶
Creates a Call object from a serialized JSON string.
- class pynenc.call.PreSerializedCall[source]¶
Bases:
pynenc.call.Call[pynenc.types.Params,pynenc.types.Result]Represents a call optimized for parallel routing with pre-serialized arguments. This call type is used for batch processing tasks with disabled concurrency control, where some arguments are pre-serialized (e.g., large shared data).
- Parameters:
- _call: pynenc.call.Call[pynenc.types.Params, pynenc.types.Result] | None¶
‘field(…)’
- _cached_arguments: pynenc.arguments.Arguments | None¶
‘field(…)’
- property arguments: pynenc.arguments.Arguments¶
- property call_id: str¶
Get the call_id from the underlying Call object.
- Returns:
A string representing the unique identifier of the call.
- property serialized_arguments: dict[str, str]¶
Serializes the call arguments into strings.
- Returns:
A dictionary of serialized argument strings.
- abstract classmethod from_json(app: pynenc.app.Pynenc, serialized: str) pynenc.call.Call[source]¶
PreSerializedCall doesn’t support from_json as it’s meant for batch routing.
- Raises:
NotImplementedError – This method is not implemented for PreSerializedCall.