gemseo / core

execution_sequence module

Abstraction for workflow

Classes:

AtomicExecSequence([discipline])

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

CompositeExecSequence([sequence])

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

ExecutionSequence([sequence])

A base class for execution sequences.

ExecutionSequenceFactory()

A factory class for ExecutionSequence objects.

ExtendableExecSequence([sequence])

A base class for composite execution sequence that are extendable.

LoopExecSequence(controller, sequence)

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

ParallelExecSequence([sequence])

A class to describe a parallel execution of disciplines.

SerialExecSequence([sequence])

A class to describe a serial execution of disciplines.

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.

Attributes:

END_STR

START_STR

parent

Get the containing execution sequence.

status

Get status value.

Methods:

accept(visitor)

Accept a visitor object (see Visitor pattern)

disable()

Unsubscribe from receiving status changes of the discipline.

enable()

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

enabled()

Get activation state.

force_statuses(status)

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.

get_state_dict()

Get the dictionary of statuses mapping atom uuid to status.

set_observer(obs)

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

update_status(discipline)

Update status from given discipline.

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

enabled()

Get activation state.

Returns

boolean True if 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.

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

property parent

Get the containing execution sequence.

Returns

a composite execution sequence.

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

property status

Get status value.

Returns

the status value (MDODiscipline.STATUS_XXX values).

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.

Attributes:

END_STR

START_STR

parent

Get the containing execution sequence.

status

Get status value.

Methods:

accept(visitor)

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

disable()

Unsubscribe subsequences from receiving status changes of disciplines.

enable()

Set the execution sequence as activated (enabled).

enabled()

Get activation state.

force_statuses(status)

Force the self status and the status of subsequences.

get_state_dict()

Get the dictionary of statuses mapping atom uuid to status.

set_observer(obs)

Set observer obs to subsequences.

update_child_status(child)

Manage status change of child execution sequences.

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.

enable()

Set the execution sequence as activated (enabled).

enabled()

Get activation state.

Returns

boolean True if enabled.

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

property parent

Get the containing execution sequence.

Returns

a composite execution sequence.

set_observer(obs)[source]

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

Parameters

obs – observer object implementing update() method

property status

Get status value.

Returns

the status value (MDODiscipline.STATUS_XXX values).

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.

Attributes:

END_STR

START_STR

parent

Get the containing execution sequence.

status

Get status value.

Methods:

accept(visitor)

Accept a visitor object (see Visitor pattern).

disable()

Set the execution sequence as deactivated (disabled).

enable()

Set the execution sequence as activated (enabled).

enabled()

Get activation state.

set_observer(obs)

Register the given observer object which is intended to be notified via its update() method each time an underlying discipline changes its status.

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

Methods:

atom(discipline)

Returns a structure representing the execution of a discipline.

loop(control, composite_sequence)

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

parallel([sequence])

Returns a structure representing the parallel execution of the given disciplines.

serial([sequence])

Returns a structure representing the serial execution of the given disciplines.

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.

Attributes:

END_STR

START_STR

parent

Get the containing execution sequence.

status

Get status value.

Methods:

accept(visitor)

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

disable()

Unsubscribe subsequences from receiving status changes of disciplines.

enable()

Set the execution sequence as activated (enabled).

enabled()

Get activation state.

extend(sequence)

Extend the execution sequence with another ExecutionSequence or a discipline.

force_statuses(status)

Force the self status and the status of subsequences.

get_state_dict()

Get the dictionary of statuses mapping atom uuid to status.

set_observer(obs)

Set observer obs to subsequences.

update_child_status(child)

Manage status change of child execution sequences.

END_STR = "'"
START_STR = "'"
accept(visitor)

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()

Unsubscribe subsequences from receiving status changes of disciplines.

enable()

Set the execution sequence as activated (enabled).

enabled()

Get activation state.

Returns

boolean True if enabled.

extend(sequence)[source]

Extend the execution sequence with another ExecutionSequence or a discipline.

Parameters

sequence – another execution sequence or

force_statuses(status)

Force the self status and the status of subsequences.

params: status value (see MDODiscipline.STATUS_XXX values)

get_state_dict()

Get the dictionary of statuses mapping atom uuid to status.

Returns

the status

property parent

Get the containing execution sequence.

Returns

a composite execution sequence.

set_observer(obs)

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

Parameters

obs – observer object implementing update() method

property status

Get status value.

Returns

the status value (MDODiscipline.STATUS_XXX values).

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 sequence_list) whose status has changed

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.

Attributes:

END_STR

START_STR

parent

Get the containing execution sequence.

status

Get status value.

Methods:

accept(visitor)

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

disable()

Unsubscribe subsequences from receiving status changes of disciplines.

enable()

Active controller execution sequence.

enabled()

Get activation state.

force_statuses(status)

Force the self status and the status of subsequences.

get_state_dict()

Get the dictionary of statuses mapping atom uuid to status.

set_observer(obs)

Set observer obs to subsequences.

update_child_status(child)

Manage status change of child execution sequences.

END_STR = '}'
START_STR = '{'
accept(visitor)

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()

Unsubscribe subsequences from receiving status changes of disciplines.

enable()[source]

Active controller execution sequence.

enabled()

Get activation state.

Returns

boolean True if enabled.

force_statuses(status)

Force the self status and the status of subsequences.

params: status value (see MDODiscipline.STATUS_XXX values)

get_state_dict()

Get the dictionary of statuses mapping atom uuid to status.

Returns

the status

property parent

Get the containing execution sequence.

Returns

a composite execution sequence.

set_observer(obs)

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

Parameters

obs – observer object implementing update() method

property status

Get status value.

Returns

the status value (MDODiscipline.STATUS_XXX values).

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 sequence_list) whose status has changed

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

Bases: gemseo.core.execution_sequence.ExtendableExecSequence

A class to describe a parallel execution of disciplines.

Attributes:

END_STR

START_STR

parent

Get the containing execution sequence.

status

Get status value.

Methods:

accept(visitor)

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

disable()

Unsubscribe subsequences from receiving status changes of disciplines.

enable()

Activate all child execution sequences.

enabled()

Get activation state.

extend(sequence)

Extend the execution sequence with another ExecutionSequence or a discipline.

force_statuses(status)

Force the self status and the status of subsequences.

get_state_dict()

Get the dictionary of statuses mapping atom uuid to status.

set_observer(obs)

Set observer obs to subsequences.

update_child_status(child)

Manage status change of child execution sequences.

END_STR = ')'
START_STR = '('
accept(visitor)

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()

Unsubscribe subsequences from receiving status changes of disciplines.

enable()[source]

Activate all child execution sequences.

enabled()

Get activation state.

Returns

boolean True if enabled.

extend(sequence)

Extend the execution sequence with another ExecutionSequence or a discipline.

Parameters

sequence – another execution sequence or

force_statuses(status)

Force the self status and the status of subsequences.

params: status value (see MDODiscipline.STATUS_XXX values)

get_state_dict()

Get the dictionary of statuses mapping atom uuid to status.

Returns

the status

property parent

Get the containing execution sequence.

Returns

a composite execution sequence.

set_observer(obs)

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

Parameters

obs – observer object implementing update() method

property status

Get status value.

Returns

the status value (MDODiscipline.STATUS_XXX values).

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 sequence_list) whose status has changed

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

Bases: gemseo.core.execution_sequence.ExtendableExecSequence

A class to describe a serial execution of disciplines.

Attributes:

END_STR

START_STR

parent

Get the containing execution sequence.

status

Get status value.

Methods:

accept(visitor)

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

disable()

Unsubscribe subsequences from receiving status changes of disciplines.

enable()

Activate first child execution sequence.

enabled()

Get activation state.

extend(sequence)

Extend the execution sequence with another ExecutionSequence or a discipline.

force_statuses(status)

Force the self status and the status of subsequences.

get_state_dict()

Get the dictionary of statuses mapping atom uuid to status.

set_observer(obs)

Set observer obs to subsequences.

update_child_status(child)

Manage status change of child execution sequences.

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

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()

Unsubscribe subsequences from receiving status changes of disciplines.

enable()[source]

Activate first child execution sequence.

enabled()

Get activation state.

Returns

boolean True if enabled.

extend(sequence)

Extend the execution sequence with another ExecutionSequence or a discipline.

Parameters

sequence – another execution sequence or

force_statuses(status)

Force the self status and the status of subsequences.

params: status value (see MDODiscipline.STATUS_XXX values)

get_state_dict()

Get the dictionary of statuses mapping atom uuid to status.

Returns

the status

property parent

Get the containing execution sequence.

Returns

a composite execution sequence.

set_observer(obs)

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

Parameters

obs – observer object implementing update() method

property status

Get status value.

Returns

the status value (MDODiscipline.STATUS_XXX values).

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 sequence_list) whose status has changed