plumpy.process_states module

class plumpy.process_states.Continue(continue_fn: Callable[[], Any], *args: Any, **kwargs: Any)[source]

Bases: plumpy.process_states.Command

CONTINUE_FN = 'continue_fn'
_auto_persist: Optional[Set[str]] = {'args', 'kwargs'}
load_instance_state(saved_state: MutableMapping[str, Any], load_context: plumpy.persistence.LoadSaveContext)None[source]
save_instance_state(out_state: MutableMapping[str, Any], save_context: plumpy.persistence.LoadSaveContext)None[source]
class plumpy.process_states.Created(process: Process, run_fn: Callable[[], Any], *args: Any, **kwargs: Any)[source]

Bases: plumpy.process_states.State

ALLOWED: Set[Union[None, enum.Enum, str]] = {<ProcessState.RUNNING: 'running'>, <ProcessState.EXCEPTED: 'excepted'>, <ProcessState.KILLED: 'killed'>}
LABEL: Union[None, enum.Enum, str] = 'created'
RUN_FN = 'run_fn'
_auto_persist: Optional[Set[str]] = {'args', 'in_state', 'kwargs'}
execute() → plumpy.base.state_machine.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: plumpy.persistence.LoadSaveContext)None[source]
save_instance_state(out_state: MutableMapping[str, Any], save_context: plumpy.persistence.LoadSaveContext)None[source]
class plumpy.process_states.Excepted(process: Process, exception: Optional[BaseException], trace_back: Optional[traceback] = None)[source]

Bases: plumpy.process_states.State

EXC_VALUE = 'ex_value'
LABEL: Union[None, enum.Enum, str] = 'excepted'
TRACEBACK = 'traceback'
get_exc_info() → Tuple[Optional[Type[BaseException]], Optional[BaseException], Optional[traceback]][source]

Recreate the exc_info tuple and return it

load_instance_state(saved_state: MutableMapping[str, Any], load_context: plumpy.persistence.LoadSaveContext)None[source]
save_instance_state(out_state: MutableMapping[str, Any], save_context: plumpy.persistence.LoadSaveContext)None[source]
class plumpy.process_states.Finished(process: Process, result: Any, successful: bool)[source]

Bases: plumpy.process_states.State

LABEL: Union[None, enum.Enum, str] = 'finished'
_auto_persist: Optional[Set[str]] = {'in_state', 'result', 'successful'}
exception plumpy.process_states.Interruption[source]

Bases: Exception

class plumpy.process_states.Kill(msg: Optional[Any] = None)[source]

Bases: plumpy.process_states.Command

_auto_persist: Optional[Set[str]] = {'msg'}
exception plumpy.process_states.KillInterruption[source]

Bases: plumpy.process_states.Interruption

class plumpy.process_states.Killed(process: Process, msg: Optional[str])[source]

Bases: plumpy.process_states.State

LABEL: Union[None, enum.Enum, str] = 'killed'
_auto_persist: Optional[Set[str]] = {'in_state', 'msg'}
exception plumpy.process_states.PauseInterruption[source]

Bases: plumpy.process_states.Interruption

class plumpy.process_states.ProcessState(value)[source]

Bases: enum.Enum

The possible states that a Process can be in.

CREATED: str = 'created'
EXCEPTED: str = 'excepted'
FINISHED: str = 'finished'
KILLED: str = 'killed'
RUNNING: str = 'running'
WAITING: str = 'waiting'
class plumpy.process_states.Running(process: Process, run_fn: Callable[[], Any], *args: Any, **kwargs: Any)[source]

Bases: plumpy.process_states.State

ALLOWED: Set[Union[None, enum.Enum, str]] = {<ProcessState.EXCEPTED: 'excepted'>, <ProcessState.WAITING: 'waiting'>, <ProcessState.KILLED: 'killed'>, <ProcessState.FINISHED: 'finished'>, <ProcessState.RUNNING: 'running'>}
COMMAND = 'command'
LABEL: Union[None, enum.Enum, str] = 'running'
RUN_FN = 'run_fn'
_action_command(command: Union[plumpy.process_states.Kill, plumpy.process_states.Stop, plumpy.process_states.Wait, plumpy.process_states.Continue]) → plumpy.process_states.State[source]
_auto_persist: Optional[Set[str]] = {'args', 'in_state', 'kwargs'}
_command: Union[None, plumpy.process_states.Kill, plumpy.process_states.Stop, plumpy.process_states.Wait, plumpy.process_states.Continue] = None
_run_handle = None
_running: bool = False
async execute() → plumpy.process_states.State[source]

Execute the state, performing the actions that this state is responsible for. :returns: a state to transition to or None if finished.

interrupt(reason: Any)None[source]
load_instance_state(saved_state: MutableMapping[str, Any], load_context: plumpy.persistence.LoadSaveContext)None[source]
save_instance_state(out_state: MutableMapping[str, Any], save_context: plumpy.persistence.LoadSaveContext)None[source]
class plumpy.process_states.Stop(result: Any, successful: bool)[source]

Bases: plumpy.process_states.Command

_auto_persist: Optional[Set[str]] = {'result'}
class plumpy.process_states.Wait(continue_fn: Optional[Callable[[], Any]] = None, msg: Optional[Any] = None, data: Optional[Any] = None)[source]

Bases: plumpy.process_states.Command

_auto_persist: Optional[Set[str]] = {'data', 'msg'}
class plumpy.process_states.Waiting(process: Process, done_callback: Optional[Callable[[], Any]], msg: Optional[str] = None, data: Optional[Any] = None)[source]

Bases: plumpy.process_states.State

ALLOWED: Set[Union[None, enum.Enum, str]] = {<ProcessState.EXCEPTED: 'excepted'>, <ProcessState.WAITING: 'waiting'>, <ProcessState.KILLED: 'killed'>, <ProcessState.FINISHED: 'finished'>, <ProcessState.RUNNING: 'running'>}
DONE_CALLBACK = 'DONE_CALLBACK'
LABEL: Union[None, enum.Enum, str] = 'waiting'
_auto_persist: Optional[Set[str]] = {'data', 'in_state', 'msg'}
_interruption = None
async execute() → plumpy.process_states.State[source]

Execute the state, performing the actions that this state is responsible for. :returns: a state to transition to or None if finished.

interrupt(reason: Any)None[source]
load_instance_state(saved_state: MutableMapping[str, Any], load_context: plumpy.persistence.LoadSaveContext)None[source]
resume(value: Any = <plumpy.lang.__NULL object>)None[source]
save_instance_state(out_state: MutableMapping[str, Any], save_context: plumpy.persistence.LoadSaveContext)None[source]