hpcflow.app.Element#

class hpcflow.app.Element(id_, is_pending, task, index, es_idx, seq_idx, src_idx, iteration_IDs, iterations)#

Bases: Element

A basic component of a workflow. Elements are enactments of tasks.

Parameters:
  • id (int) – The ID of this element.

  • is_pending (bool) – Whether this element is pending execution.

  • task (WorkflowTask) – The task this is part of the enactment of.

  • index (int) – The index of this element.

  • es_idx (int) – The index within the task of the element set containing this element.

  • seq_idx (dict[str, int]) – The sequence index IDs.

  • src_idx (dict[str, int]) – The input source indices.

  • iteration_IDs (list[int]) – The known IDs of iterations,

  • iterations (list[dict]) – Data for creating iteration objects.

  • id_ (int) –

Methods

get

Get element data of the most recent iteration from the persistent store.

get_EAR_dependencies

Get EARs that the most recent iteration of this element depends on.

get_data_idx

Get the data index of the most recent element iteration.

get_dependent_EARs

Get EARs that depend on the most recent iteration of this element.

get_dependent_element_iterations

Get element iterations that depend on the most recent iteration of this element.

get_dependent_elements

Get elements that depend on the most recent iteration of this element.

get_dependent_elements_recursively

Get downstream elements that depend on this element, including recursive dependencies.

get_dependent_tasks

Get tasks that depend on the most recent iteration of this element.

get_element_dependencies

Get elements that the most recent iteration of this element depends on.

get_element_iteration_dependencies

Get element iterations that the most recent iteration of this element depends on.

get_input_dependencies

Get locally defined inputs/sequences/defaults from other tasks that this the most recent iteration of this element depends on.

get_parameter_sources

"Get the parameter sources of the most recent element iteration.

get_sequence_value

Get the value of a sequence that applies.

get_task_dependencies

Get tasks (insert ID or WorkflowTask objects) that the most recent iteration of this element depends on.

init_loop_index

Initialise the loop index if necessary.

to_element_set_data

Generate lists of workflow-bound InputValues and ResourceList.

Attributes

action_runs

A list of element action runs from the latest iteration, where only the final run is taken for each element action.

actions

The actions of this element (or its most recent iteration).

app

dir_name

The name of the directory for containing temporary files for this element.

element_set

The element set containing this element.

element_set_idx

The index within the task of the element set containing this element.

id_

The ID of this element.

index

Get the index of the element within the task.

input_files

The input files to this element (or its most recent iteration).

input_source_idx

The input source indices.

input_sources

The sources of the inputs to this element.

inputs

The inputs to this element (or its most recent iteration).

is_pending

Whether this element is pending execution.

iteration_IDs

The IDs of the iterations of this element.

iterations

The iterations of this element.

latest_iteration

The most recent iteration of this element.

output_files

The output files from this element (or its most recent iteration).

outputs

The outputs from this element (or its most recent iteration).

schema_parameters

The schema-defined parameters to this element (or its most recent iteration).

sequence_idx

The sequence index IDs.

task

The task this is part of the enactment of.

workflow

The workflow containing this element.

property action_runs: List[ElementActionRun]#

A list of element action runs from the latest iteration, where only the final run is taken for each element action.

property actions: Dict[app.ElementAction]#

The actions of this element (or its most recent iteration).

app = BaseApp(name='hpcFlow', version='0.2.0a180')#
property dir_name#

The name of the directory for containing temporary files for this element.

property element_set#

The element set containing this element.

property element_set_idx: int#

The index within the task of the element set containing this element.

get(path=None, action_idx=None, run_idx=-1, default=None, raise_on_missing=False, raise_on_unset=False)#

Get element data of the most recent iteration from the persistent store.

Parameters:
  • path (str) –

  • action_idx (int) –

  • run_idx (int) –

  • default (Any) –

  • raise_on_missing (bool) –

  • raise_on_unset (bool) –

Return type:

Any

get_EAR_dependencies(as_objects=False)#

Get EARs that the most recent iteration of this element depends on.

Parameters:

as_objects (bool) –

Return type:

List[int | ElementActionRun]

get_data_idx(path=None, action_idx=None, run_idx=-1)#

Get the data index of the most recent element iteration.

Parameters:
  • action_idx (int) – The index of the action within the schema.

  • path (str) –

  • run_idx (int) –

Return type:

Dict[str, int]

get_dependent_EARs(as_objects=False)#

Get EARs that depend on the most recent iteration of this element.

Parameters:

as_objects (bool) –

Return type:

List[int | ElementActionRun]

get_dependent_element_iterations(as_objects=False)#

Get element iterations that depend on the most recent iteration of this element.

Parameters:

as_objects (bool) –

Return type:

List[int | ElementIteration]

get_dependent_elements(as_objects=False)#

Get elements that depend on the most recent iteration of this element.

Parameters:

as_objects (bool) –

Return type:

List[int | Element]

get_dependent_elements_recursively(task_insert_ID=None)#

Get downstream elements that depend on this element, including recursive dependencies.

Dependencies are resolved using the initial iteration only. This method is used to identify from which element in the previous iteration a new iteration should be parametrised.

Parameters:

task_insert_ID – If specified, only return elements from this task.

get_dependent_tasks(as_objects=False)#

Get tasks that depend on the most recent iteration of this element.

Parameters:

as_objects (bool) –

Return type:

List[int | WorkflowTask]

get_element_dependencies(as_objects=False)#

Get elements that the most recent iteration of this element depends on.

Parameters:

as_objects (bool) –

Return type:

List[int | Element]

get_element_iteration_dependencies(as_objects=False)#

Get element iterations that the most recent iteration of this element depends on.

Parameters:

as_objects (bool) –

Return type:

List[int | ElementIteration]

get_input_dependencies()#

Get locally defined inputs/sequences/defaults from other tasks that this the most recent iteration of this element depends on.

Return type:

Dict[str, Dict]

get_parameter_sources(path=None, action_idx=None, run_idx=-1, typ=None, as_strings=False, use_task_index=False)#

“Get the parameter sources of the most recent element iteration.

Parameters:
  • use_task_index (bool) – If True, use the task index within the workflow, rather than the task insert ID.

  • path (str) –

  • action_idx (int) –

  • run_idx (int) –

  • typ (str) –

  • as_strings (bool) –

Return type:

Dict[str, str | Dict[str, Any]]

get_sequence_value(sequence_path)#

Get the value of a sequence that applies.

Parameters:

sequence_path (str) –

Return type:

Any

get_task_dependencies(as_objects=False)#

Get tasks (insert ID or WorkflowTask objects) that the most recent iteration of this element depends on.

Dependencies may come from either elements from upstream tasks, or from locally defined inputs/sequences/defaults from upstream tasks.

Parameters:

as_objects (bool) –

Return type:

List[int | WorkflowTask]

property id_: int#

The ID of this element.

property index: int#

Get the index of the element within the task.

Note: the global_idx attribute returns the index of the element within the workflow, across all tasks.

init_loop_index(loop_name)#

Initialise the loop index if necessary.

Parameters:

loop_name (str) –

property input_files: ElementInputFiles#

The input files to this element (or its most recent iteration).

property input_source_idx: Dict[str, int]#

The input source indices.

property input_sources: Dict[str, InputSource]#

The sources of the inputs to this element.

property inputs: ElementInputs#

The inputs to this element (or its most recent iteration).

property is_pending: bool#

Whether this element is pending execution.

property iteration_IDs: List[int]#

The IDs of the iterations of this element.

property iterations: List[ElementIteration]#

The iterations of this element.

property latest_iteration#

The most recent iteration of this element.

property output_files: ElementOutputFiles#

The output files from this element (or its most recent iteration).

property outputs: ElementOutputs#

The outputs from this element (or its most recent iteration).

property schema_parameters: List[str]#

The schema-defined parameters to this element (or its most recent iteration).

property sequence_idx: Dict[str, int]#

The sequence index IDs.

property task: WorkflowTask#

The task this is part of the enactment of.

to_element_set_data()#

Generate lists of workflow-bound InputValues and ResourceList.

property workflow: Workflow#

The workflow containing this element.