gemseo.core.execution_status module#
Execution status of processes.
- class ExecutionStatus(process_name)[source]#
Bases:
SerializableExecution 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
RUNNINGorLINEARIZINGcan only be set when the current one isDONE,the status
DONEcan only be set when the current one isRUNNING.
Helper methods should be used to handle the statuses when executing a monitored process, e.g., a
Disciplineor anMDOScenario, using the methodexecute(), or linearizing aDisciplineusing the methodlinearize().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(*values)[source]#
Bases:
StrEnumThe 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 toDONE.- 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