matflow.ElementIteration#

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

Bases: ElementIteration

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

param action_idx:

The index of the action within the schema.

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

param use_task_index:

If True, use the task index within the workflow, rather than the task insert

get_resources

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

get_resources_obj

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

EAR_IDs_flat

EARs_initialised

Whether or not the EARs have been initialised.

action_runs

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

actions

app

data_idx

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

element

id_

index

input_files

inputs

is_pending

loop_idx

output_files

outputs

schema_parameters

task

workflow

Parameters:
  • id_ (int) –

  • is_pending (bool) –

  • index (int) –

  • element (app.Element) –

  • data_idx (Dict) –

  • EARs_initialised (bool) –

  • EAR_IDs (Dict[int, int]) –

  • EARs (Union[List[Dict], None]) –

  • schema_parameters (List[str]) –

  • loop_idx (Dict) –

property EAR_IDs: Dict[int, int]#
property EAR_IDs_flat#
property EARs_initialised#

Whether or not the EARs have been initialised.

property action_runs: List[ElementActionRun]#

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

property actions: Dict[app.ElementAction]#
app = App(name='MatFlow', version='0.3.0a129')#
property data_idx#

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

property element#
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)#
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 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)#
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)#
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#
property index#
property input_files: ElementInputFiles#
property inputs: ElementInputs#
property is_pending: bool#
property loop_idx: Dict[str, int]#
property output_files: ElementOutputFiles#
property outputs: ElementOutputs#
property schema_parameters: List[str]#
property task#
property workflow#