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 – a visitor object implementing visit_atomic() method

disable()[source]

Unsubscribe from receiving status changes of the discipline

enable()[source]

Subscribe to status changes of the discipline (notified via update_status())

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.

Param

status value (see MDODiscipline.STATUS_XXX values)

get_state_dict()[source]

Get the dictionary of statuses mapping atom uuid to status

Returns

the status

set_observer(obs)[source]

Register given observer obs to be notified (obs.update()) when discipline status changes.

Parameters

obs – the observe object implementing update() method

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

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. Intented to be subclassed.

END_STR = "'"
START_STR = "'"
accept(visitor)[source]

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

Parameters

visitor – a visitor object implementing visit_serial() method

disable()[source]

Unsubscribe subsequences from receiving status changes of disciplines

force_statuses(status)[source]

Force the self status and the status of subsequences.

params: status value (see MDODiscipline.STATUS_XXX values)

get_state_dict()[source]

Get the dictionary of statuses mapping atom uuid to status

Returns

the status

set_observer(obs)[source]

Set observer obs to subsequences. Override super.set_observer()

Parameters

obs – observer object implementing 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 sequence_list) whose status has changed

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.

END_STR = ']'
START_STR = '['
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

boolean True if enabled.

property parent

Get the containing execution sequence

Returns

a composite execution sequence.

set_observer(obs)[source]

Register the given observer object which 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 list.

property status

Get status value.

Returns

the status value (MDODiscipline.STATUS_XXX values).

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

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

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. Intented to be subclassed.

extend(sequence)[source]

Extend the execution sequence with another ExecutionSequence or a discipline.

Parameters

sequence – another execution sequence or

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

Bases: gemseo.core.execution_sequence.CompositeExecSequence

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

END_STR = '}'
START_STR = '{'
enable()[source]

Active controller execution sequence

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

Bases: gemseo.core.execution_sequence.ExtendableExecSequence

A class to describe a parallel execution of disciplines

END_STR = ')'
START_STR = '('
enable()[source]

Activate all child execution sequences.

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

Bases: gemseo.core.execution_sequence.ExtendableExecSequence

A class to describe a serial execution of disciplines

END_STR = ']'
START_STR = '['
enable()[source]

Activate first child execution sequence.