hpcflow.app.WorkflowLoop#

class hpcflow.app.WorkflowLoop(index, workflow, template, num_added_iterations, iterable_parameters, parents)#

Bases: WorkflowLoop

Class to represent a Loop that is bound to a Workflow.

Parameters:
  • index (int) – The index of this loop in the workflow.

  • workflow (Workflow) – The workflow containing this loop.

  • template (Loop) – The loop that this was generated from.

  • num_added_iterations (dict[tuple[int, ...], int]) – Description of what iterations have been added.

  • iterable_parameters (dict[str, IterableParam]) – Description of what parameters are being iterated over.

  • parents (list[str]) – The paths to the parent entities of this loop.

Methods

add_iteration

Add an iteration to this loop.

get_child_loops

Get loops whose task subset is a subset of this loop's task subset.

get_parent_loops

Get loops whose task subset is a superset of this loop's task subset.

new_empty_loop

Make a new empty loop.

test_termination

Check if a loop should terminate, given the specified completed element iteration.

Attributes

downstream_tasks

Tasks that are not part of the loop, and downstream from this loop.

index

The index of this loop within its workflow.

iterable_parameters

The parameters that are being iterated over.

name

The name of this loop, if one is defined.

num_added_iterations

The number of added iterations.

num_iterations

The number of iterations.

parents

The parents of this loop.

task_indices

The list of task indices that define the extent of the loop.

task_insert_IDs

The insertion IDs of the tasks inside this loop.

task_objects

The tasks in this loop.

template

The loop template for this loop.

upstream_tasks

Tasks that are not part of the loop, and upstream from this loop.

workflow

The workflow containing this loop.

add_iteration(parent_loop_indices=None, cache=None)#

Add an iteration to this loop.

Parameters:
  • parent_loop_indices (Mapping[str, int] | None) – Where have any parent loops got up to?

  • cache (LoopCache | None) – A cache used to make adding the iteration more efficient. One will be created if it is not supplied.

Return type:

None

property downstream_tasks: Iterator[WorkflowTask]#

Tasks that are not part of the loop, and downstream from this loop.

get_child_loops()#

Get loops whose task subset is a subset of this loop’s task subset. If two loops have identical task subsets, the first loop in the workflow loop list is considered the child.

Return type:

list[hpcflow.sdk.core.loop.WorkflowLoop]

get_parent_loops()#

Get loops whose task subset is a superset of this loop’s task subset. If two loops have identical task subsets, the first loop in the workflow loop list is considered the child.

Return type:

list[hpcflow.sdk.core.loop.WorkflowLoop]

property index: int#

The index of this loop within its workflow.

property iterable_parameters: Mapping[str, IterableParam]#

The parameters that are being iterated over.

property name: str#

The name of this loop, if one is defined.

classmethod new_empty_loop(index, workflow, template, iter_loop_idx)#

Make a new empty loop.

Parameters:
  • index (int) – The index of the loop to create.

  • workflow (Workflow) – The workflow that will contain the loop.

  • template (Loop) – The template for the loop.

  • iter_loop_idx (list[dict]) – Iteration information from parent loops.

Return type:

WorkflowLoop

property num_added_iterations: Mapping[tuple[int, ...], int]#

The number of added iterations.

property num_iterations: int#

The number of iterations.

property parents: Sequence[str]#

The parents of this loop.

property task_indices: tuple[int, ...]#

The list of task indices that define the extent of the loop.

property task_insert_IDs: tuple[int, ...]#

The insertion IDs of the tasks inside this loop.

property task_objects: tuple[WorkflowTask, ...]#

The tasks in this loop.

property template: Loop#

The loop template for this loop.

test_termination(element_iter)#

Check if a loop should terminate, given the specified completed element iteration.

Return type:

bool

property upstream_tasks: Iterator[WorkflowTask]#

Tasks that are not part of the loop, and upstream from this loop.

property workflow: Workflow#

The workflow containing this loop.