plumpy.process_states module#
- class plumpy.process_states.Continue(continue_fn: Callable[[...], Any], *args: Any, **kwargs: Any)[source]#
Bases:
Command- CONTINUE_FN = 'continue_fn'#
- load_instance_state(saved_state: MutableMapping[str, Any], load_context: LoadSaveContext) None[source]#
- save_instance_state(out_state: MutableMapping[str, Any], save_context: LoadSaveContext) None[source]#
- class plumpy.process_states.Created(process: Process, run_fn: Callable[..., Any], *args: Any, **kwargs: Any)[source]#
Bases:
State- ALLOWED: Set[LABEL_TYPE] = {ProcessState.EXCEPTED, ProcessState.KILLED, ProcessState.RUNNING}#
- LABEL: LABEL_TYPE = 'created'#
- RUN_FN = 'run_fn'#
- execute() State[source]#
Execute the state, performing the actions that this state is responsible for. :returns: a state to transition to or None if finished.
- load_instance_state(saved_state: MutableMapping[str, Any], load_context: LoadSaveContext) None[source]#
- save_instance_state(out_state: MutableMapping[str, Any], save_context: LoadSaveContext) None[source]#
- class plumpy.process_states.Excepted(process: Process, exception: BaseException | None, trace_back: TracebackType | None = None)[source]#
Bases:
StateExcepted state, can optionally provide exception and trace_back
- Parameters:
exception – The exception instance
trace_back – An optional exception traceback
- EXC_VALUE = 'ex_value'#
- LABEL: LABEL_TYPE = 'excepted'#
- TRACEBACK = 'traceback'#
- get_exc_info() Tuple[Type[BaseException] | None, BaseException | None, TracebackType | None][source]#
Recreate the exc_info tuple and return it
- load_instance_state(saved_state: MutableMapping[str, Any], load_context: LoadSaveContext) None[source]#
- save_instance_state(out_state: MutableMapping[str, Any], save_context: LoadSaveContext) None[source]#
- class plumpy.process_states.Finished(process: Process, result: Any, successful: bool)[source]#
Bases:
StateState for process is finished.
- Parameters:
result – The result of process
successful – Boolean for the exit code is
0the process is successful.
- LABEL: LABEL_TYPE = 'finished'#
- exception plumpy.process_states.KillInterruption(msg_text: str | None, force_kill: bool = False)[source]#
Bases:
Interruption
- class plumpy.process_states.Killed(process: Process, msg: MessageType | None)[source]#
Bases:
StateRepresents a state where a process has been killed.
This state is used to indicate that a process has been terminated and can optionally include a message providing details about the termination.
- Parameters:
msg – An optional message explaining the reason for the process termination.
- LABEL: LABEL_TYPE = 'killed'#
- exception plumpy.process_states.PauseInterruption(msg_text: str | None)[source]#
Bases:
Interruption
- class plumpy.process_states.ProcessState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#
Bases:
EnumThe possible states that a
Processcan be in.- CREATED = 'created'#
- EXCEPTED = 'excepted'#
- FINISHED = 'finished'#
- KILLED = 'killed'#
- RUNNING = 'running'#
- WAITING = 'waiting'#
- class plumpy.process_states.Running(process: Process, run_fn: Callable[..., Awaitable[Any] | Any], *args: Any, **kwargs: Any)[source]#
Bases:
State- ALLOWED: Set[LABEL_TYPE] = {ProcessState.EXCEPTED, ProcessState.FINISHED, ProcessState.KILLED, ProcessState.RUNNING, ProcessState.WAITING}#
- COMMAND = 'command'#
- LABEL: LABEL_TYPE = 'running'#
- RUN_FN = 'run_fn'#
- _run_handle = None#
- async execute() State[source]#
Execute the state, performing the actions that this state is responsible for. :returns: a state to transition to or None if finished.
- load_instance_state(saved_state: MutableMapping[str, Any], load_context: LoadSaveContext) None[source]#
- save_instance_state(out_state: MutableMapping[str, Any], save_context: LoadSaveContext) None[source]#
- class plumpy.process_states.Wait(continue_fn: Callable[[...], Any] | None = None, msg: Any | None = None, data: Any | None = None)[source]#
Bases:
Command
- class plumpy.process_states.Waiting(process: Process, done_callback: Callable[..., Any] | None, msg: str | None = None, data: Any | None = None)[source]#
Bases:
State- ALLOWED: Set[LABEL_TYPE] = {ProcessState.EXCEPTED, ProcessState.FINISHED, ProcessState.KILLED, ProcessState.RUNNING, ProcessState.WAITING}#
- DONE_CALLBACK = 'DONE_CALLBACK'#
- LABEL: LABEL_TYPE = 'waiting'#
- _interruption = None#
- _waiting_future: futures.Future#
- async execute() State[source]#
Execute the state, performing the actions that this state is responsible for. :returns: a state to transition to or None if finished.
- load_instance_state(saved_state: MutableMapping[str, Any], load_context: LoadSaveContext) None[source]#
- save_instance_state(out_state: MutableMapping[str, Any], save_context: LoadSaveContext) None[source]#