hpcflow.sdk.core.loop.Loop#

class hpcflow.sdk.core.loop.Loop(tasks, num_iterations, name=None, non_iterable_parameters=None, termination=None)#

Bases: JSONLike

A loop in a workflow template.

Parameters:
  • tasks (list[int | WorkflowTask]) – List of task insert IDs or workflow tasks.

  • num_iterations (int) – Number of iterations to perform.

  • name (str) – Loop name.

  • non_iterable_parameters (list[str]) – Specify input parameters that should not iterate.

  • termination (v~hpcflow.app.Rule) – Stopping criterion, expressed as a rule.

Methods

from_json_like

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

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

name

The name of the loop, if one was provided.

non_iterable_parameters

Which parameters are not iterable.

num_iterations

The number of loop iterations to do.

task_insert_IDs

Get the list of task insert_IDs that define the extent of the loop.

task_objects

The tasks in the loop.

termination

A termination rule for the loop, if one is provided.

workflow_template

The workflow template that contains this loop.

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.

property name#

The name of the loop, if one was provided.

property non_iterable_parameters#

Which parameters are not iterable.

property num_iterations#

The number of loop iterations to do.

property task_insert_IDs: Tuple[int]#

Get the list of task insert_IDs that define the extent of the loop.

property task_objects: Tuple[WorkflowTask]#

The tasks in the loop.

property termination#

A termination rule for the loop, if one is provided.

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 workflow_template#

The workflow template that contains this loop.