matflow.ElementSet#

class matflow.ElementSet(inputs=None, input_files=None, sequences=None, resources=None, repeats=None, groups=None, input_sources=None, nesting_order=None, env_preset=None, environments=None, sourceable_elem_iters=None, allow_non_coincident_task_sources=False, merge_envs=True)#

Bases: ElementSet

Class to represent a parameterisation of a new set of elements.

Parameters:
  • inputs (list[InputValue]) – Inputs to the set of elements.

  • input_files (list[InputFile]) – Input files to the set of elements.

  • sequences (list[ValueSequence]) – Input value sequences to parameterise over.

  • resources (ResourceList) – Resources to use for the set of elements.

  • repeats (list[dict]) – Description of how to repeat the set of elements.

  • groups (list[ElementGroup]) – Groupings in the set of elements.

  • input_sources (dict[str, InputSource]) – Input source descriptors.

  • nesting_order (dict[str, int]) – How to handle nesting of iterations.

  • env_preset (str) – Which environment preset to use. Don’t use at same time as environments.

  • environments (dict) – Environment descriptors to use. Don’t use at same time as env_preset.

  • sourceable_elem_iters (list[int]) – If specified, a list of global element iteration indices from which inputs for the new elements associated with this element set may be sourced. If not specified, all workflow element iterations are considered sourceable.

  • allow_non_coincident_task_sources (bool) – If True, if more than one parameter is sourced from the same task, then allow these sources to come from distinct element sub-sets. If False (default), only the intersection of element sub-sets for all parameters are included.

  • merge_envs (bool) – If True, merge environments into resources using the “any” scope. If False, environments are ignored. This is required on first initialisation, but not on subsequent re-initialisation from a persistent workflow.

Methods

ensure_element_sets

Make an instance after validating some argument combinations.

from_json_like

Make an instance of this class from JSON (or YAML) data.

get_defined_parameter_types

Get the parameter types of this element set.

get_defined_sub_parameter_types

Get the sub-parameter types of this element set.

get_locally_defined_inputs

Get the input types that this element set defines.

get_sequence_from_path

Get the value sequence for the given path, if it exists.

get_task_dependencies

Get upstream tasks that this element set depends on.

is_input_type_provided

Check if an input is provided locally as an InputValue or a ValueSequence.

prepare_persistent_copy

Return a copy of self, which will then be made persistent, and save copies of attributes that may be changed during integration with the workflow.

to_dict

Serialize this object as a dictionary.

to_json_like

Serialize this object as an object structure that can be trivially converted to JSON.

Attributes

app

defined_input_types

The input types to this element set.

elem_iter_IDs

The IDs of the iterations in this element set.

element_iterations

The iterations in this element set.

element_local_idx_range

Indices of elements belonging to this element set.

elements

The elements in this element set.

index

The index of this element set in its' template task's collection of sets.

input_types

The input types of the inputs to this element set.

task

The concrete task corresponding to this element set.

task_template

The abstract task this was derived from.

undefined_input_types

The input types to the abstract task that aren't related to this element set.

inputs

Inputs to the set of elements.

input_files

Input files to the set of elements.

repeats

Description of how to repeat the set of elements.

groups

Groupings in the set of elements.

resources

Resources to use for the set of elements.

sequences

Input value sequences to parameterise over.

input_sources

Input source descriptors.

nesting_order

How to handle nesting of iterations.

env_preset

Which environment preset to use.

environments

Environment descriptors to use.

sourceable_elem_iters

List of global element iteration indices from which inputs for the new elements associated with this element set may be sourced.

allow_non_coincident_task_sources

Whether to allow sources to come from distinct element sub-sets.

merge_envs

Whether to merge environments into resources using the "any" scope on first initialisation.

allow_non_coincident_task_sources#

Whether to allow sources to come from distinct element sub-sets.

app = App(name='MatFlow', version='0.3.0a132')#
property defined_input_types#

The input types to this element set.

property elem_iter_IDs#

The IDs of the iterations in this element set.

property element_iterations#

The iterations in this element set.

property element_local_idx_range#

Indices of elements belonging to this element set.

property elements#

The elements in this element set.

classmethod ensure_element_sets(inputs=None, input_files=None, sequences=None, resources=None, repeats=None, groups=None, input_sources=None, nesting_order=None, env_preset=None, environments=None, allow_non_coincident_task_sources=None, element_sets=None, sourceable_elem_iters=None)#

Make an instance after validating some argument combinations.

env_preset#

Which environment preset to use.

environments#

Environment descriptors to use.

classmethod from_json_like(json_like, shared_data=None)#

Make an instance of this class from JSON (or YAML) data.

Parameters:
  • json_like (Union[Dict, List]) – The data to deserialise.

  • shared_data (Optional[Dict[str, ObjectList]]) – Shared context data.

Return type:

The deserialised object.

get_defined_parameter_types()#

Get the parameter types of this element set.

get_defined_sub_parameter_types()#

Get the sub-parameter types of this element set.

get_locally_defined_inputs()#

Get the input types that this element set defines.

get_sequence_from_path(sequence_path)#

Get the value sequence for the given path, if it exists.

get_task_dependencies(as_objects=False)#

Get upstream tasks that this element set depends on.

groups#

Groupings in the set of elements.

property index#

The index of this element set in its’ template task’s collection of sets.

input_files#

Input files to the set of elements.

input_sources#

Input source descriptors.

property input_types#

The input types of the inputs to this element set.

inputs#

Inputs to the set of elements.

is_input_type_provided(labelled_path)#

Check if an input is provided locally as an InputValue or a ValueSequence.

Parameters:

labelled_path (str) –

Return type:

bool

merge_envs#

Whether to merge environments into resources using the “any” scope on first initialisation.

nesting_order#

How to handle nesting of iterations.

prepare_persistent_copy()#

Return a copy of self, which will then be made persistent, and save copies of attributes that may be changed during integration with the workflow.

repeats#

Description of how to repeat the set of elements.

resources#

Resources to use for the set of elements.

sequences#

Input value sequences to parameterise over.

sourceable_elem_iters#

List of global element iteration indices from which inputs for the new elements associated with this element set may be sourced. If None, all iterations are valid.

property task#

The concrete task corresponding to this element set.

property task_template#

The abstract task this was derived from.

to_dict()#

Serialize this object as a dictionary.

to_json_like(dct=None, shared_data=None, exclude=None, path=None)#

Serialize this object as an object structure that can be trivially converted to JSON. Note that YAML can also be produced from the result of this method; it just requires a different final serialization step.

property undefined_input_types#

The input types to the abstract task that aren’t related to this element set.