hpcflow.app.ElementIteration#

class hpcflow.app.ElementIteration(id_, is_pending, index, element, data_idx, EARs_initialised, EAR_IDs, EARs, schema_parameters, loop_idx)#

Bases: ElementIteration

A particular iteration of an element.

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

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

  • index (int) – The index of this iteration in its parent element.

  • element (Element) – The element this is an iteration of.

  • data_idx (dict) – The overall element iteration data index, before resolution of EARs.

  • EARs_initialised (bool) – Whether EARs have been set up for the iteration.

  • EAR_IDs (dict[int, int]) – Mapping from iteration number to EAR ID, where known.

  • EARs (list[dict]) – Data about EARs.

  • schema_parameters (list[str]) – Parameters from the schema.

  • loop_idx (dict[str, int]) – Indexing information from the loop.

  • id_ (int) –

Methods

get

Get element data from the persistent store.

get_EAR_dependencies

Get EARs that this element iteration depends on (excluding EARs of this element iteration).

get_data_idx

Get the data index.

get_dependent_EARs

Get EARs of downstream iterations and tasks that depend on this element iteration.

get_dependent_element_iterations

Get elements iterations of downstream iterations and tasks that depend on this element iteration.

get_dependent_elements

Get elements of downstream tasks that depend on this element iteration.

get_dependent_tasks

Get downstream tasks that depend on this element iteration.

get_element_dependencies

Get elements that this element iteration depends on.

get_element_iteration_dependencies

Get element iterations that this element iteration depends on.

get_input_dependencies

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

get_parameter_names

Get parameter types associated with a given prefix.

get_parameter_sources

Get the origin of parameters.

get_resources

Resolve specific resources for the specified action of this iteration, considering all applicable scopes.

get_resources_obj

Get the resources for an action (see get_resources()) as a searchable model.

get_task_dependencies

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

get_template_resources

Get template-level resources.

Attributes

EAR_IDs

Mapping from iteration number to EAR ID, where known.

EAR_IDs_flat

The EAR IDs.

EARs_initialised

Whether or not the EARs have been initialised.

action_runs

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

actions

The actions of this iteration.

app

data_idx

The overall element iteration data index, before resolution of EARs.

element

The element this is an iteration of.

id_

The ID of this iteration.

index

The index of this iteration in its parent element.

input_files

The input files to this element.

inputs

The inputs to this element.

is_pending

Whether this iteration is pending execution.

loop_idx

Indexing information from the loop.

output_files

The output files from this element.

outputs

The outputs from this element.

schema_parameters

Parameters from the schema.

task

The task this is an iteration of an element for.

workflow

The workflow this is a part of.

property EAR_IDs: Dict[int, int]#

Mapping from iteration number to EAR ID, where known.

property EAR_IDs_flat#

The EAR IDs.

property EARs_initialised#

Whether or not the EARs have been initialised.

property action_runs: List[ElementActionRun]#

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

property actions: Dict[app.ElementAction]#

The actions of this iteration.

app = BaseApp(name='hpcFlow', version='0.2.0a181')#
property data_idx#

The overall element iteration data index, before resolution of EARs.

property element#

The element this is an iteration of.

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

Get element data 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 this element iteration depends on (excluding EARs of this element iteration).

Parameters:

as_objects (bool | None) –

Return type:

List[int | ElementActionRun]

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

Get the data index.

Parameters:
  • path (str) – If specified, filters the data indices to the ones relevant to this path.

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

  • run_idx (int) – The index of the run within the action.

Return type:

Dict[str, int]

get_dependent_EARs(as_objects=False)#

Get EARs of downstream iterations and tasks that depend on this element iteration.

Parameters:

as_objects (bool) –

Return type:

List[int | ElementActionRun]

get_dependent_element_iterations(as_objects=False)#

Get elements iterations of downstream iterations and tasks that depend on this element iteration.

Parameters:

as_objects (bool) –

Return type:

List[int | ElementIteration]

get_dependent_elements(as_objects=False)#

Get elements of downstream tasks that depend on this element iteration.

Parameters:

as_objects (bool) –

Return type:

List[int | Element]

get_dependent_tasks(as_objects=False)#

Get downstream tasks that depend on this element iteration.

Parameters:

as_objects (bool) –

Return type:

List[int | WorkflowTask]

get_element_dependencies(as_objects=False)#

Get elements that this element iteration depends on.

Parameters:

as_objects (bool | None) –

Return type:

List[int | Element]

get_element_iteration_dependencies(as_objects=False)#

Get element iterations that this element iteration 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 element iteration depends on.

Return type:

Dict[str, Dict]

get_parameter_names(prefix)#

Get parameter types associated with a given prefix.

For example, with the prefix “inputs”, this would return [‘p1’, ‘p2’] for a task schema that has input types p1 and p2. For inputs, labels are ignored. For example, for a task schema that accepts two inputs of the same type p1, with labels one and two, this method would return (for the “inputs” prefix): [‘p1[one]’, ‘p1[two]’].

This method is distinct from Action.get_parameter_names in that it returns schema-level inputs/outputs, whereas Action.get_parameter_names returns action-level input/output/file types/labels.

Parameters:

prefix (str) – One of “inputs”, “outputs”.

Return type:

List[str]

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

Get the origin of parameters.

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_resources(action, set_defaults=False)#

Resolve specific resources for the specified action of this iteration, considering all applicable scopes.

Parameters:
  • set_defaults (bool) – If True, include machine-defaults for os_name, shell and scheduler.

  • action (Action) –

Return type:

Dict

get_resources_obj(action, set_defaults=False)#

Get the resources for an action (see get_resources()) as a searchable model.

Parameters:
Return type:

ElementResources

get_task_dependencies(as_objects=False)#

Get tasks (insert ID or WorkflowTask objects) that this element iteration 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]

get_template_resources()#

Get template-level resources.

Return type:

Dict

property id_: int#

The ID of this iteration.

property index#

The index of this iteration in its parent element.

property input_files: ElementInputFiles#

The input files to this element.

property inputs: ElementInputs#

The inputs to this element.

property is_pending: bool#

Whether this iteration is pending execution.

property loop_idx: Dict[str, int]#

Indexing information from the loop.

property output_files: ElementOutputFiles#

The output files from this element.

property outputs: ElementOutputs#

The outputs from this element.

property schema_parameters: List[str]#

Parameters from the schema.

property task#

The task this is an iteration of an element for.

property workflow#

The workflow this is a part of.