pypz.executors.operator.executor module

class pypz.executors.operator.executor.OperatorExecutor(operator: Operator, handle_interrupts: bool = True)

Bases: object

This class has the purpose of executing an Operator along with its nested plugins. The execution is based on a state machine, where each state is responsible to execute specific entities’ corresponding methods.

Parameters:
  • operator – the actual operator instance to execute

  • handle_interrupts – if True, then the execution can be interrupted by system signals

__context: ExecutionContext | None

The stored execution context for this executor

__initialize(exec_mode: ExecutionMode = ExecutionMode.Standard) None

Initializes the execution states and context.

Parameters:

exec_mode – the run mode if the execution (refer to ExecutorRunMode)

__is_running: SynchronizedReference[bool]

Flag that signalizes, whether the state machine is running

__operator: Operator

The actual operator instance, which shall be processed by the state machine

__priority_signal: SynchronizedReference[BaseSignal]

Reference to the priority signal. Note that this atomic variable was necessary, because there might be functionality that attempts to change the current signal. Direct changing is not really a lucky choice if changing from a separate thread is allowed (e.g. from shutdown hook). Therefore all the external entities are allowed to change the priority signal

execute(exec_mode: ExecutionMode = ExecutionMode.Standard) int

Initializes and triggers execution. Note that, since every time, if this method is called, the persisted state of the execution and of its context is re-initialized, hence this method is idempotent.

Parameters:

exec_mode – the run mode if the execution (refer to ExecutorRunMode)

Returns:

exit code (refer to ExitCodes)

get_current_signal()
get_current_state()
interrupt(signal_number=None, current_stack=None)
is_running()