pynenc.exceptions

Global Pynenc exception and warning classes.

Module Contents

API

exception pynenc.exceptions.PynencError[source]

Bases: Exception

Base class for all Pynenc related errors.

Initialization

Initialize self. See help(type(self)) for accurate signature.

_to_json_dict() dict[str, Any][source]
Returns:

a json serializable dictionary

classmethod _from_json_dict(json_dict: dict[str, Any]) pynenc.exceptions.PynencError[source]
Returns:

a new error from the serialized json compatible dictionary

to_json() str[source]
Returns:

the serialized error

classmethod from_json(error_name: str, serialized: str) pynenc.exceptions.PynencError[source]
Returns:

the child class from a serialized error

exception pynenc.exceptions.RetryError[source]

Bases: pynenc.exceptions.PynencError

Error raised when a task should be retried.

Initialization

Initialize self. See help(type(self)) for accurate signature.

exception pynenc.exceptions.ConcurrencyRetryError[source]

Bases: pynenc.exceptions.RetryError

Error raised when a task should be retried due to concurrency control.

Initialization

Initialize self. See help(type(self)) for accurate signature.

exception pynenc.exceptions.SerializationError(message: str)[source]

Bases: pynenc.exceptions.PynencError

Error raised when an argument cannot be serialized.

Wraps the original serialization error with context about which argument failed and truncated value information to aid debugging.

Initialization

Initialize self. See help(type(self)) for accurate signature.

__str__() str[source]
exception pynenc.exceptions.TaskError(task_id: pynenc.identifiers.task_id.TaskId, message: str | None = None)[source]

Bases: pynenc.exceptions.PynencError

Base class for all Task related errors.

Initialization

Initialize self. See help(type(self)) for accurate signature.

__str__() str[source]
_to_json_dict() dict[str, Any][source]
Returns:

the serialized error

classmethod _from_json_dict(json_dict: dict[str, Any]) pynenc.exceptions.TaskError[source]
Returns:

the serialized error

exception pynenc.exceptions.InvalidTaskOptionsError(task_id: pynenc.identifiers.task_id.TaskId, message: str | None = None)[source]

Bases: pynenc.exceptions.TaskError

Error raised when the task options are invalid.

Initialization

Initialize self. See help(type(self)) for accurate signature.

exception pynenc.exceptions.TaskRoutingError(task_id: pynenc.identifiers.task_id.TaskId, message: str | None = None)[source]

Bases: pynenc.exceptions.TaskError

Error raised when a task will not be routed.

Initialization

Initialize self. See help(type(self)) for accurate signature.

exception pynenc.exceptions.TaskParallelProcessingError(task_id: pynenc.identifiers.task_id.TaskId, message: str | None = None)[source]

Bases: pynenc.exceptions.TaskError

Error parallelizing a task.

Initialization

Initialize self. See help(type(self)) for accurate signature.

exception pynenc.exceptions.InvocationConcurrencyWithDifferentArgumentsError(task_id: pynenc.identifiers.task_id.TaskId, existing_invocation_id: str, new_call_id: pynenc.identifiers.call_id.CallId, diff: str, message: str | None = None)[source]

Bases: pynenc.exceptions.TaskRoutingError

Error raised when there is a task with different arguments than the current task.

Initialization

Initialize self. See help(type(self)) for accurate signature.

classmethod from_call_mismatch(existing_invocation: pynenc.invocation.BaseInvocation, new_call: pynenc.call.Call, message: str | None = None) pynenc.exceptions.InvocationConcurrencyWithDifferentArgumentsError[source]
static format_difference(existing_call: pynenc.call.Call, new_call: pynenc.call.Call) str[source]

Format argument differences in a clear, concise way.

__str__() str[source]
_to_json_dict() dict[str, Any][source]
Returns:

the serialized error

classmethod _from_json_dict(json_dict: dict[str, str]) pynenc.exceptions.InvocationConcurrencyWithDifferentArgumentsError[source]
Returns:

a new error from a serialized error

exception pynenc.exceptions.InvocationError(invocation_id: str, message: str | None = None)[source]

Bases: pynenc.exceptions.PynencError

Base class for all Task related errors.

Initialization

Initialize self. See help(type(self)) for accurate signature.

__str__() str[source]
_to_json_dict() dict[str, Any][source]
classmethod _from_json_dict(json_dict: dict[str, Any]) pynenc.exceptions.InvocationError[source]
exception pynenc.exceptions.StateBackendError[source]

Bases: pynenc.exceptions.PynencError

Error raised when a task will not be routed.

Initialization

Initialize self. See help(type(self)) for accurate signature.

exception pynenc.exceptions.InvocationNotFoundError(invocation_id: str, message: str | None = None)[source]

Bases: pynenc.exceptions.StateBackendError

Error raised when the invocation is not present in the State Backend.

Initialization

Initialize self. See help(type(self)) for accurate signature.

__str__() str[source]
_to_json_dict() dict[str, Any][source]
classmethod _from_json_dict(json_dict: dict[str, Any]) pynenc.exceptions.InvocationNotFoundError[source]
exception pynenc.exceptions.RunnerNotExecutableError[source]

Bases: pynenc.exceptions.PynencError

Raised when trying to execute a runner that is not meant to be executed.

Initialization

Initialize self. See help(type(self)) for accurate signature.

exception pynenc.exceptions.RunnerError[source]

Bases: pynenc.exceptions.PynencError

Base class for all Runner related errors.

Initialization

Initialize self. See help(type(self)) for accurate signature.

exception pynenc.exceptions.ConfigError[source]

Bases: pynenc.exceptions.PynencError

Base class for all the config related errors

Initialization

Initialize self. See help(type(self)) for accurate signature.

exception pynenc.exceptions.ConfigMultiInheritanceError[source]

Bases: pynenc.exceptions.ConfigError

Error related with multiinheritance of config fields

Initialization

Initialize self. See help(type(self)) for accurate signature.

exception pynenc.exceptions.AlreadyInitializedError[source]

Bases: pynenc.exceptions.PynencError

Error raised when trying to change the class of a component after it was initialized

Initialization

Initialize self. See help(type(self)) for accurate signature.

exception pynenc.exceptions.InvocationStatusError[source]

Bases: pynenc.exceptions.PynencError

Base class for all invocation status related errors.

Use this to catch any error related to status transitions, ownership, or final status modifications.

Initialization

Initialize self. See help(type(self)) for accurate signature.

exception pynenc.exceptions.InvocationStatusRaceConditionError(invocation_id: str, previous_status_record: pynenc.invocation.InvocationStatusRecord, expected_status_record: pynenc.invocation.InvocationStatusRecord, actual_status_record: pynenc.invocation.InvocationStatusRecord)[source]

Bases: pynenc.exceptions.InvocationStatusError

Raised when a race condition is detected in non-atomic status updates.

This error occurs in non-atomic orchestrators when the actual status differs from the expected status after a write operation, indicating concurrent modification.

Initialization

Create a race condition error.

Parameters:
__str__() str[source]
_to_json_dict() dict[str, Any][source]
classmethod _from_json_dict(json_dict: dict[str, Any]) pynenc.exceptions.InvocationStatusRaceConditionError[source]
exception pynenc.exceptions.InvocationStatusTransitionError(from_status: InvocationStatus | None, to_status: pynenc.invocation.InvocationStatus, allowed_statuses: frozenset[pynenc.invocation.InvocationStatus])[source]

Bases: pynenc.exceptions.InvocationStatusError

Raised when attempting an invalid invocation status transition.

This error occurs when trying to change an invocation’s status to a state that is not allowed by the state machine rules.

Initialization

Create an invalid state transition error.

Parameters:
__str__() str[source]
_to_json_dict() dict[str, Any][source]
classmethod _from_json_dict(json_dict: dict[str, Any]) pynenc.exceptions.InvocationStatusTransitionError[source]
exception pynenc.exceptions.InvocationStatusOwnershipError(from_status: InvocationStatus | None, to_status: pynenc.invocation.InvocationStatus, current_owner: str | None, attempted_owner: str | None, reason: str)[source]

Bases: pynenc.exceptions.InvocationStatusError

Raised when attempting to modify an invocation without proper ownership.

This error occurs when:

  • A non-owner tries to modify an owned invocation

  • Attempting to acquire ownership without providing a runner ID

  • A status requiring ownership has no owner set (invalid state)

Initialization

Create an invocation ownership error.

Parameters:
  • from_status (InvocationStatus | None) – Current status

  • to_status (InvocationStatus) – Attempted target status

  • current_owner (str | None) – Current owner ID

  • attempted_owner (str | None) – ID of runner attempting the change

  • reason (str) – Explanation of why ownership was violated

__str__() str[source]
_to_json_dict() dict[str, Any][source]
classmethod _from_json_dict(json_dict: dict[str, Any]) pynenc.exceptions.InvocationStatusOwnershipError[source]