gemseo / core

execution_sequence module

Abstraction for workflow

class gemseo.core.execution_sequence.AtomicExecSequence(discipline=None)[source]

Bases: gemseo.core.execution_sequence.ExecutionSequence

An execution sequence to represent the single execution of a given discipline.

accept(visitor)[source]

Accept a visitor object (see Visitor pattern).

Parameters

visitor – An object implementing the visit_atomic() method.

disable()[source]

Unsubscribe from receiving status changes of the discipline.

enable()[source]

Subscribe to status changes of the discipline.

Notified via the update_status() method.

enabled()

Get activation state.

Returns

Whether the execution sequence is enabled.

force_statuses(status)[source]

Force the self status and the status of subsequences without notifying the parent (as the force_status is called by a parent), but notify the observer is status changed.

Parameters

status – The value of the status, one of MDODiscipline.AVAILABLE_STATUSES.

get_statuses()[source]

Get the dictionary of statuses mapping atom uuid to status.

Parameters

status. (The statuses mapping atom uuid to) –

set_observer(obs)[source]

Register a given observer to be notified when discipline status changes.

Parameters

obs – An object implementing the update() method for notification.

update_status(discipline)[source]

Update status from given discipline.

Reflect the status then notifies the parent and the observer if any. Note: update_status if discipline status change actually compared to current, otherwise do nothing.

Parameters

discipline – The discipline whose status changed.

END_STR = ']'
START_STR = '['
property parent

Get the containing execution sequence.

Returns

The execution sequence containing the current one.

property status

Get the value of the status.

One of MDODiscipline.AVAILABLE_STATUSES.

Returns

The value of the status.

class gemseo.core.execution_sequence.CompositeExecSequence(sequence=None)[source]

Bases: gemseo.core.execution_sequence.ExecutionSequence

A base class for execution sequence made of other execution sequences.

Intended to be subclassed.

accept(visitor)[source]

Accept a visitor object (see Visitor pattern) and then make its children accept it too.

Parameters

visitor – A visitor object implementing the visit_serial() method.

disable()[source]

Unsubscribe subsequences from receiving status changes of disciplines.

enable()

Set the execution sequence as activated (enabled).

enabled()

Get activation state.

Returns

Whether the execution sequence is enabled.

force_statuses(status)[source]

Force the self status and the status of subsequences.

Parameters

status – The value of the status, one of MDODiscipline.AVAILABLE_STATUSES.

get_statuses()[source]

Get the dictionary of statuses mapping atom uuid to status.

Returns

The statuses related to the atom uuid.

set_observer(obs)[source]

Set observer obs to subsequences.

Override super.set_observer()

Parameters

obs – An object implementing the meth:update method.

update_child_status(child)[source]

Manage status change of child execution sequences. Propagates status change to the parent (containing execution sequence)

Parameters

child – The child execution sequence (contained in sequences) whose status has changed.

END_STR = "'"
START_STR = "'"
disciplines: list[gemseo.core.discipline.MDODiscipline]

The disciplines.

property parent

Get the containing execution sequence.

Returns

The execution sequence containing the current one.

sequences: list[gemseo.core.execution_sequence.ExecutionSequence]

The inner execution sequences.

property status

Get the value of the status.

One of MDODiscipline.AVAILABLE_STATUSES.

Returns

The value of the status.

class gemseo.core.execution_sequence.ExecutionSequence(sequence=None)[source]

Bases: object

A base class for execution sequences.

The execution sequence structure is introduced to reflect the main workflow implicitly executed by GEMSEO regarding the given scenario/formulation executed. That structure allows to identify single executions of a same discipline that may be run several times at various stages in the given scenario/formulation.

accept(visitor)[source]

Accept a visitor object (see Visitor pattern).

Have to be implemented by subclasses.

Parameters

visitor – A visitor object.

disable()[source]

Set the execution sequence as deactivated (disabled).

enable()[source]

Set the execution sequence as activated (enabled).

enabled()[source]

Get activation state.

Returns

Whether the execution sequence is enabled.

set_observer(obs)[source]

Register an observer.

This observer is intended to be notified via its update() method each time an underlying discipline changes its status. To be implemented in subclasses.

Returns

The disciplines.

END_STR = ']'
START_STR = '['
property parent

Get the containing execution sequence.

Returns

The execution sequence containing the current one.

property status

Get the value of the status.

One of MDODiscipline.AVAILABLE_STATUSES.

Returns

The value of the status.

class gemseo.core.execution_sequence.ExecutionSequenceFactory[source]

Bases: object

A factory class for ExecutionSequence objects.

Allow to create AtomicExecutionSequence, SerialExecutionSequence, ParallelExecutionSequence and LoopExecutionSequence. Main GEMSEO workflow is intended to be expressed with those four ExecutionSequence types

static atom(discipline)[source]

Returns a structure representing the execution of a discipline. This function is intended to be called by MDOFormulation.get_expected_workflow methods.

Parameters

discipline – A discipline.

Returns

The structure used within XDSM workflow representation.

static loop(control, composite_sequence)[source]

Returns a structure representing a loop execution of a This function is intended to be called by MDOFormulation.get_expected_workflow methods.

Parameters
  • control – The discipline object, controller of the loop.

  • composite_sequence – Any number of discipline or the return value of a serial, parallel or loop call.

Returns

A loop execution sequence.

static parallel(sequence=None)[source]

Returns a structure representing the parallel execution of the given disciplines. This function is intended to be called by MDOFormulation.get_expected_workflow methods.

Parameters

sequence

Any number of discipline or the return value of a serial, parallel or loop call.

By default it is set to None.

Returns

A parallel execution sequence.

static serial(sequence=None)[source]

Returns a structure representing the serial execution of the given disciplines. This function is intended to be called by MDOFormulation.get_expected_workflow methods.

Parameters

sequence

Any number of discipline or the return value of a serial, parallel or loop call.

By default it is set to None.

Returns

A serial execution sequence.

class gemseo.core.execution_sequence.ExtendableExecSequence(sequence=None)[source]

Bases: gemseo.core.execution_sequence.CompositeExecSequence

A base class for composite execution sequence that are extendable.

Intended to be subclassed.

accept(visitor)

Accept a visitor object (see Visitor pattern) and then make its children accept it too.

Parameters

visitor – A visitor object implementing the visit_serial() method.

disable()

Unsubscribe subsequences from receiving status changes of disciplines.

enable()

Set the execution sequence as activated (enabled).

enabled()

Get activation state.

Returns

Whether the execution sequence is enabled.

extend(sequence)[source]

Extend the execution sequence with another sequence or discipline(s).

Parameters

sequence – Either another execution sequence or one or several disciplines.

Returns

The extended execution sequence.

force_statuses(status)

Force the self status and the status of subsequences.

Parameters

status – The value of the status, one of MDODiscipline.AVAILABLE_STATUSES.

get_statuses()

Get the dictionary of statuses mapping atom uuid to status.

Returns

The statuses related to the atom uuid.

set_observer(obs)

Set observer obs to subsequences.

Override super.set_observer()

Parameters

obs – An object implementing the meth:update method.

update_child_status(child)

Manage status change of child execution sequences. Propagates status change to the parent (containing execution sequence)

Parameters

child – The child execution sequence (contained in sequences) whose status has changed.

END_STR = "'"
START_STR = "'"
disciplines: list[gemseo.core.discipline.MDODiscipline]

The disciplines.

property parent

Get the containing execution sequence.

Returns

The execution sequence containing the current one.

sequences: list[gemseo.core.execution_sequence.ExecutionSequence]

The inner execution sequences.

property status

Get the value of the status.

One of MDODiscipline.AVAILABLE_STATUSES.

Returns

The value of the status.

class gemseo.core.execution_sequence.LoopExecSequence(controller, sequence)[source]

Bases: gemseo.core.execution_sequence.CompositeExecSequence

A loop with a controller discipline and an execution_sequence as iterate.

accept(visitor)

Accept a visitor object (see Visitor pattern) and then make its children accept it too.

Parameters

visitor – A visitor object implementing the visit_serial() method.

disable()

Unsubscribe subsequences from receiving status changes of disciplines.

enable()[source]

Active controller execution sequence.

enabled()

Get activation state.

Returns

Whether the execution sequence is enabled.

force_statuses(status)

Force the self status and the status of subsequences.

Parameters

status – The value of the status, one of MDODiscipline.AVAILABLE_STATUSES.

get_statuses()

Get the dictionary of statuses mapping atom uuid to status.

Returns

The statuses related to the atom uuid.

set_observer(obs)

Set observer obs to subsequences.

Override super.set_observer()

Parameters

obs – An object implementing the meth:update method.

update_child_status(child)

Manage status change of child execution sequences. Propagates status change to the parent (containing execution sequence)

Parameters

child – The child execution sequence (contained in sequences) whose status has changed.

END_STR = '}'
START_STR = '{'
disciplines: list[gemseo.core.discipline.MDODiscipline]

The disciplines.

property parent

Get the containing execution sequence.

Returns

The execution sequence containing the current one.

sequences: list[gemseo.core.execution_sequence.ExecutionSequence]

The inner execution sequences.

property status

Get the value of the status.

One of MDODiscipline.AVAILABLE_STATUSES.

Returns

The value of the status.

class gemseo.core.execution_sequence.ParallelExecSequence(sequence=None)[source]

Bases: gemseo.core.execution_sequence.ExtendableExecSequence

A class to describe a parallel execution of disciplines.

accept(visitor)

Accept a visitor object (see Visitor pattern) and then make its children accept it too.

Parameters

visitor – A visitor object implementing the visit_serial() method.

disable()

Unsubscribe subsequences from receiving status changes of disciplines.

enable()[source]

Activate all child execution sequences.

enabled()

Get activation state.

Returns

Whether the execution sequence is enabled.

extend(sequence)

Extend the execution sequence with another sequence or discipline(s).

Parameters

sequence – Either another execution sequence or one or several disciplines.

Returns

The extended execution sequence.

force_statuses(status)

Force the self status and the status of subsequences.

Parameters

status – The value of the status, one of MDODiscipline.AVAILABLE_STATUSES.

get_statuses()

Get the dictionary of statuses mapping atom uuid to status.

Returns

The statuses related to the atom uuid.

set_observer(obs)

Set observer obs to subsequences.

Override super.set_observer()

Parameters

obs – An object implementing the meth:update method.

update_child_status(child)

Manage status change of child execution sequences. Propagates status change to the parent (containing execution sequence)

Parameters

child – The child execution sequence (contained in sequences) whose status has changed.

END_STR = ')'
START_STR = '('
disciplines: list[gemseo.core.discipline.MDODiscipline]

The disciplines.

property parent

Get the containing execution sequence.

Returns

The execution sequence containing the current one.

sequences: list[gemseo.core.execution_sequence.ExecutionSequence]

The inner execution sequences.

property status

Get the value of the status.

One of MDODiscipline.AVAILABLE_STATUSES.

Returns

The value of the status.

class gemseo.core.execution_sequence.SerialExecSequence(sequence=None)[source]

Bases: gemseo.core.execution_sequence.ExtendableExecSequence

A class to describe a serial execution of disciplines.

accept(visitor)

Accept a visitor object (see Visitor pattern) and then make its children accept it too.

Parameters

visitor – A visitor object implementing the visit_serial() method.

disable()

Unsubscribe subsequences from receiving status changes of disciplines.

enable()[source]

Activate first child execution sequence.

enabled()

Get activation state.

Returns

Whether the execution sequence is enabled.

extend(sequence)

Extend the execution sequence with another sequence or discipline(s).

Parameters

sequence – Either another execution sequence or one or several disciplines.

Returns

The extended execution sequence.

force_statuses(status)

Force the self status and the status of subsequences.

Parameters

status – The value of the status, one of MDODiscipline.AVAILABLE_STATUSES.

get_statuses()

Get the dictionary of statuses mapping atom uuid to status.

Returns

The statuses related to the atom uuid.

set_observer(obs)

Set observer obs to subsequences.

Override super.set_observer()

Parameters

obs – An object implementing the meth:update method.

update_child_status(child)

Manage status change of child execution sequences. Propagates status change to the parent (containing execution sequence)

Parameters

child – The child execution sequence (contained in sequences) whose status has changed.

END_STR = ']'
START_STR = '['
disciplines: list[gemseo.core.discipline.MDODiscipline]

The disciplines.

property parent

Get the containing execution sequence.

Returns

The execution sequence containing the current one.

sequences: list[gemseo.core.execution_sequence.ExecutionSequence]

The inner execution sequences.

property status

Get the value of the status.

One of MDODiscipline.AVAILABLE_STATUSES.

Returns

The value of the status.