hpcflow.app.WorkflowTemplate#

class hpcflow.app.WorkflowTemplate(name, doc=None, tasks=<factory>, loops=<factory>, workflow=None, resources=None, environments=None, env_presets=None, source_file=None, store_kwargs=<factory>, merge_resources=True, merge_envs=True)#

Bases: WorkflowTemplate

Class to represent initial parametrisation of a hpcFlow workflow, with limited validation logic.

Parameters:
  • name (str) – A string name for the workflow. By default this name will be used in combination with a date-time stamp when generating a persistent workflow from the template.

  • tasks (List[hpcflow.app.Task] | None) – A list of Task objects to include in the workflow.

  • loops (List[hpcflow.app.Loop] | None) – A list of Loop objects to include in the workflow.

  • resources (Dict[str, Dict] | None) – Template-level resources to apply to all tasks as default values. This can be a dict that maps action scopes to resources (e.g. {“any”: {“num_cores”: 2}}) or a list of ResourceSpec objects, or a ResourceList object.

  • merge_resources (bool | None) – If True, merge template-level resources into element set resources. If False, template-level resources are ignored.

  • doc (List[str] | str | None) –

  • workflow (Workflow | None) –

  • environments (Dict[str, Dict[str, Any]] | None) –

  • env_presets (List[str] | str | None) –

  • source_file (str | None) –

  • store_kwargs (Dict | None) –

  • merge_envs (bool | None) –

Methods

from_JSON_file

Load from a JSON file.

from_JSON_string

Load from a JSON string.

from_YAML_file

Load from a YAML file.

from_YAML_string

Load from a YAML string.

from_file

Load from either a YAML or JSON file, depending on the file extension.

from_json_like

to_dict

to_json_like

Attributes

app

doc

env_presets

environments

merge_envs

merge_resources

resources

source_file

workflow

name

tasks

loops

store_kwargs

app = BaseApp(name='hpcFlow', version='0.2.0a167')#
doc: List[str] | str | None = None#
env_presets: str | List[str] | None = None#
environments: Dict[str, Dict[str, Any]] | None = None#
classmethod from_JSON_file(path, variables=None)#

Load from a JSON file.

Parameters:
  • path (PathLike) – The path to the JSON file containing the workflow template parametrisation.

  • variables (Dict[str, str] | None) – String variables to substitute in the file given by path.

Return type:

WorkflowTemplate

classmethod from_JSON_string(string, variables=None)#

Load from a JSON string.

Parameters:
  • string (str) – The JSON string containing the workflow template parametrisation.

  • variables (Dict[str, str] | None) – String variables to substitute in string.

Return type:

WorkflowTemplate

classmethod from_YAML_file(path, variables=None)#

Load from a YAML file.

Parameters:
  • path (PathLike) – The path to the YAML file containing the workflow template parametrisation.

  • variables (Dict[str, str] | None) – String variables to substitute in the file given by path.

Return type:

WorkflowTemplate

classmethod from_YAML_string(string, variables=None)#

Load from a YAML string.

Parameters:
  • string (str) – The YAML string containing the workflow template parametrisation.

  • variables (Dict[str, str] | None) – String variables to substitute in string.

Return type:

WorkflowTemplate

classmethod from_file(path, template_format=None, variables=None)#

Load from either a YAML or JSON file, depending on the file extension.

Parameters:
  • path (PathLike) – The path to the file containing the workflow template parametrisation.

  • template_format (str | None) – The file format to expect at path. One of “json” or “yaml”, if specified. By default, “yaml”.

  • variables (Dict[str, str] | None) – String variables to substitute in the file given by path.

Return type:

WorkflowTemplate

classmethod from_json_like(json_like, shared_data=None)#
Parameters:
  • json_like (Union[Dict, List]) –

  • shared_data (Optional[Dict[str, ObjectList]]) –

loops: List[app.Loop] | None#
merge_envs: bool | None = True#
merge_resources: bool | None = True#
name: str#
resources: Dict[str, Dict] | None = None#
source_file: str | None = None#
store_kwargs: Dict | None#
tasks: List[app.Task] | None#
to_dict()#
to_json_like(dct=None, shared_data=None, exclude=None, path=None)#
workflow: app.Workflow | None = None#