gemseo.core.execution_status module#

Execution status of processes.

class ExecutionStatus(process_name)[source]#

Bases: Serializable

Execution status of a process.

The status aims at monitoring a process and give the user a simplified view on the state of the processes.

The possible statuses are defined in Status. The status rules are: - the initial status is DONE, - the status RUNNING or LINEARIZING can only be set when the current one is

DONE,

  • the status DONE can only be set when the current one is RUNNING.

Helper methods should be used to handle the statuses when running or linearizing a process: run() and linearize().

Observers can be attached and are notified when the value of the status is changed. The observers are not restored after pickling.

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

Parameters:

process_name (str) -- The name of the process.

class Status(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: StrEnum

The statuses.

DONE = 'DONE'#
FAILED = 'FAILED'#
LINEARIZING = 'LINEARIZING'#
RUNNING = 'RUNNING'#
add_observer(observer)[source]#

Add an observer.

Parameters:

observer (BaseExecutionStatusObserver) -- The observer to add.

Return type:

None

handle(status, function, *args)[source]#

Handle a status while executing a function.

On exception, the status is set to FAILED, otherwise is set to DONE.

Parameters:
  • status (Status) -- The status to be set before execution.

  • function (Callable[[Any], None]) -- The function to be called.

  • *args (Any) -- The argument to be passed for calling the function.

Return type:

None

remove_observer(observer)[source]#

Remove an observer.

Parameters:

observer (BaseExecutionStatusObserver) -- The observer to remove.

Return type:

None

property value: Status#

The status of the process.