hpcflow.sdk.core.task.ElementSet#
- class hpcflow.sdk.core.task.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:
JSONLike
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
intoresources
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
Make an instance after validating some argument combinations.
Make an instance of this class from JSON (or YAML) data.
Get the parameter types of this element set.
Get the sub-parameter types of this element set.
Get the input types that this element set defines.
Get the value sequence for the given path, if it exists.
Get upstream tasks that this element set depends on.
Check if an input is provided locally as an InputValue or a ValueSequence.
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.
Serialize this object as a dictionary.
Serialize this object as an object structure that can be trivially converted to JSON.
Attributes
The input types to this element set.
The IDs of the iterations in this element set.
The iterations in this element set.
Indices of elements belonging to this element set.
The elements in this element set.
The index of this element set in its' template task's collection of sets.
The input types of the inputs to this element set.
The concrete task corresponding to this element set.
The abstract task this was derived from.
The input types to the abstract task that aren't related to this element set.
Inputs to the set of elements.
Input files to the set of elements.
Description of how to repeat the set of elements.
Groupings in the set of elements.
Resources to use for the set of elements.
Input value sequences to parameterise over.
Input source descriptors.
How to handle nesting of iterations.
Which environment preset to use.
Environment descriptors to use.
List of global element iteration indices from which inputs for the new elements associated with this element set may be sourced.
Whether to allow sources to come from distinct element sub-sets.
Whether to merge
environments
intoresources
using the "any" scope on first initialisation.- allow_non_coincident_task_sources#
Whether to allow sources to come from distinct element sub-sets.
- 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.
- merge_envs#
Whether to merge
environments
intoresources
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.