gemseo / core

Hide inherited members

execution_sequence module

Abstraction for workflow.

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

Bases: ExecutionSequence

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

Parameters:

discipline (MDODiscipline | None) – A discipline.

accept(visitor)[source]

Accept a visitor object (see Visitor pattern).

Parameters:

visitor – An object implementing the visit_atomic() method.

Return type:

None

disable()[source]

Unsubscribe from receiving status changes of the discipline.

Return type:

None

enable()[source]

Subscribe to status changes of the discipline.

Notified via the update_status() method.

Return type:

None

enabled()

Get activation state.

Returns:

Whether the execution sequence is enabled.

Return type:

bool

force_statuses(status)[source]

Force the self status and the status of subsequences.

This is done 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.ExecutionStatus.

Return type:

None

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.

Returns:

The disciplines.

Return type:

None

update_status(discipline)[source]

Update status from given discipline.

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

Parameters:

discipline – The discipline whose status changed.

Return type:

None

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.ExecutionStatus.

Returns:

The value of the status.

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

Bases: ExecutionSequence

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

Intended to be subclassed.

Parameters:

sequence – This argument is not used.

accept(visitor)[source]

Accept a visitor object and then make its children accept it too.

Parameters:

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

Return type:

None

disable()[source]

Unsubscribe subsequences from receiving status changes of disciplines.

Return type:

None

enable()

Set the execution sequence as activated (enabled).

Return type:

None

enabled()

Get activation state.

Returns:

Whether the execution sequence is enabled.

Return type:

bool

force_statuses(status)[source]

Force the self status and the status of subsequences.

Parameters:

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

Return type:

None

get_statuses()[source]

Get the dictionary of statuses mapping atom uuid to status.

Returns:

The statuses related to the atom uuid.

Return type:

dict[str, str]

set_observer(obs)[source]

Set observer obs to subsequences.

Override super.set_observer()

Parameters:

obs – An object implementing the meth:update method.

Returns:

The disciplines.

Return type:

None

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.

Return type:

None

END_STR = "'"
START_STR = "'"
disciplines: list[MDODiscipline]

The disciplines.

property parent

Get the containing execution sequence.

Returns:

The execution sequence containing the current one.

sequences: list[ExecutionSequence]

The inner execution sequences.

property status

Get the value of the status.

One of MDODiscipline.ExecutionStatus.

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.

Parameters:

sequence – This argument is not used.

abstract 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).

Return type:

None

enable()[source]

Set the execution sequence as activated (enabled).

Return type:

None

enabled()[source]

Get activation state.

Returns:

Whether the execution sequence is enabled.

Return type:

bool

abstract 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.ExecutionStatus.

Returns:

The value of the status.

class gemseo.core.execution_sequence.ExecutionSequenceFactory[source]

Bases: object

A factory of 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]

Return 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.

Return type:

AtomicExecSequence

static loop(control, composite_sequence)[source]

Return a structure representing a loop execution of a function.

It 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.

Return type:

LoopExecSequence

static parallel(sequence=None)[source]

Return a structure representing the parallel execution of 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.

Return type:

ParallelExecSequence

static serial(sequence=None)[source]

Return a structure representing the serial execution of 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.

Return type:

SerialExecSequence

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

Bases: CompositeExecSequence

A base class for composite execution sequence that are extendable.

Intended to be subclassed.

Parameters:

sequence – This argument is not used.

accept(visitor)

Accept a visitor object and then make its children accept it too.

Parameters:

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

Return type:

None

disable()

Unsubscribe subsequences from receiving status changes of disciplines.

Return type:

None

enable()

Set the execution sequence as activated (enabled).

Return type:

None

enabled()

Get activation state.

Returns:

Whether the execution sequence is enabled.

Return type:

bool

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.ExecutionStatus.

Return type:

None

get_statuses()

Get the dictionary of statuses mapping atom uuid to status.

Returns:

The statuses related to the atom uuid.

Return type:

dict[str, str]

set_observer(obs)

Set observer obs to subsequences.

Override super.set_observer()

Parameters:

obs – An object implementing the meth:update method.

Returns:

The disciplines.

Return type:

None

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.

Return type:

None

END_STR = "'"
START_STR = "'"
disciplines: list[MDODiscipline]

The disciplines.

property parent

Get the containing execution sequence.

Returns:

The execution sequence containing the current one.

sequences: list[ExecutionSequence]

The inner execution sequences.

property status

Get the value of the status.

One of MDODiscipline.ExecutionStatus.

Returns:

The value of the status.

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

Bases: CompositeExecSequence

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

Parameters:
accept(visitor)

Accept a visitor object and then make its children accept it too.

Parameters:

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

Return type:

None

disable()

Unsubscribe subsequences from receiving status changes of disciplines.

Return type:

None

enable()[source]

Active controller execution sequence.

Return type:

None

enabled()

Get activation state.

Returns:

Whether the execution sequence is enabled.

Return type:

bool

force_statuses(status)

Force the self status and the status of subsequences.

Parameters:

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

Return type:

None

get_statuses()

Get the dictionary of statuses mapping atom uuid to status.

Returns:

The statuses related to the atom uuid.

Return type:

dict[str, str]

set_observer(obs)

Set observer obs to subsequences.

Override super.set_observer()

Parameters:

obs – An object implementing the meth:update method.

Returns:

The disciplines.

Return type:

None

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.

Return type:

None

END_STR = '}'
START_STR = '{'
disciplines: list[MDODiscipline]

The disciplines.

property parent

Get the containing execution sequence.

Returns:

The execution sequence containing the current one.

sequences: list[ExecutionSequence]

The inner execution sequences.

property status

Get the value of the status.

One of MDODiscipline.ExecutionStatus.

Returns:

The value of the status.

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

Bases: ExtendableExecSequence

A class to describe a parallel execution of disciplines.

Parameters:

sequence – This argument is not used.

accept(visitor)

Accept a visitor object and then make its children accept it too.

Parameters:

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

Return type:

None

disable()

Unsubscribe subsequences from receiving status changes of disciplines.

Return type:

None

enable()[source]

Activate all child execution sequences.

Return type:

None

enabled()

Get activation state.

Returns:

Whether the execution sequence is enabled.

Return type:

bool

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.ExecutionStatus.

Return type:

None

get_statuses()

Get the dictionary of statuses mapping atom uuid to status.

Returns:

The statuses related to the atom uuid.

Return type:

dict[str, str]

set_observer(obs)

Set observer obs to subsequences.

Override super.set_observer()

Parameters:

obs – An object implementing the meth:update method.

Returns:

The disciplines.

Return type:

None

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.

Return type:

None

END_STR = ')'
START_STR = '('
disciplines: list[MDODiscipline]

The disciplines.

property parent

Get the containing execution sequence.

Returns:

The execution sequence containing the current one.

sequences: list[ExecutionSequence]

The inner execution sequences.

property status

Get the value of the status.

One of MDODiscipline.ExecutionStatus.

Returns:

The value of the status.

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

Bases: ExtendableExecSequence

A class to describe a serial execution of disciplines.

Parameters:

sequence – This argument is not used.

accept(visitor)

Accept a visitor object and then make its children accept it too.

Parameters:

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

Return type:

None

disable()

Unsubscribe subsequences from receiving status changes of disciplines.

Return type:

None

enable()[source]

Activate first child execution sequence.

Return type:

None

enabled()

Get activation state.

Returns:

Whether the execution sequence is enabled.

Return type:

bool

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.ExecutionStatus.

Return type:

None

get_statuses()

Get the dictionary of statuses mapping atom uuid to status.

Returns:

The statuses related to the atom uuid.

Return type:

dict[str, str]

set_observer(obs)

Set observer obs to subsequences.

Override super.set_observer()

Parameters:

obs – An object implementing the meth:update method.

Returns:

The disciplines.

Return type:

None

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.

Return type:

None

END_STR = ']'
START_STR = '['
disciplines: list[MDODiscipline]

The disciplines.

property parent

Get the containing execution sequence.

Returns:

The execution sequence containing the current one.

sequences: list[ExecutionSequence]

The inner execution sequences.

property status

Get the value of the status.

One of MDODiscipline.ExecutionStatus.

Returns:

The value of the status.

Examples using AtomicExecSequence

Scenario

Scenario