hpcflow.app.InputSource#
- class hpcflow.app.InputSource(source_type, import_ref=None, task_ref=None, task_source_type=None, element_iters=None, path=None, where=None)#
Bases:
InputSource
An input source to a workflow task.
- Parameters:
source_type (InputSourceType) – Type of the input source.
import_ref (int | None) – Where the input comes from when the type is IMPORT.
task_ref (int | None) – Which task is this an input for? Used when the type is TASK.
task_source_type (TaskSourceType) – Type of task source.
element_iters (list[int] | None) – Which element iterations does this apply to?
path (str | None) – Path to where this input goes.
where (Rule | list[Rule] | ElementFilter) – Filtering rules.
Methods
Make an instance of an input source that is default.
Make an instance of this class from JSON (or YAML) data.
Parse a dot-delimited string definition of an InputSource.
If source_type is task, then return the referenced task from the given workflow.
Make an instance of an input source that is an import.
Check if this input source is in a list of other input sources, without considering the element_iters and where attributes.
Make an instance of an input source that is local.
Make an instance of an input source that is a task.
Serialize this object as a dictionary.
Serialize this object as an object structure that can be trivially converted to JSON.
Render this input source as a string.
Attributes
Filtering rules.
Type of the input source.
Where the input comes from when the type is IMPORT.
Which task is this an input for? Used when the type is TASK.
Type of task source.
Which element iterations does this apply to?
Path to where this input goes.
- classmethod default()#
Make an instance of an input source that is default.
- Return type:
Self
- element_iters#
Which element iterations does this apply to?
- classmethod from_json_like(json_like, shared_data=None)#
Make an instance of this class from JSON (or YAML) data.
- Parameters:
json_like – The data to deserialise.
shared_data – Shared context data.
- Return type:
The deserialised object.
- classmethod from_string(str_defn)#
Parse a dot-delimited string definition of an InputSource.
Parameter#
- str_defn:
The string to parse.
Examples
task.[task_ref].input task.[task_ref].output local default import.[import_ref]
- Parameters:
str_defn (str) –
- Return type:
Self
- get_task(workflow)#
If source_type is task, then return the referenced task from the given workflow.
- Parameters:
workflow (Workflow) –
- Return type:
WorkflowTask | None
- classmethod import_(import_ref, element_iters=None, where=None)#
Make an instance of an input source that is an import.
- import_ref#
Where the input comes from when the type is IMPORT.
- is_in(other_input_sources)#
Check if this input source is in a list of other input sources, without considering the element_iters and where attributes.
- Parameters:
other_input_sources (Sequence[InputSource]) –
- Return type:
int | None
- classmethod local()#
Make an instance of an input source that is local.
- Return type:
Self
- path#
Path to where this input goes.
- source_type#
Type of the input source.
- classmethod task(task_ref, task_source_type=None, element_iters=None, where=None)#
Make an instance of an input source that is a task.
- Parameters:
task_ref (int) – Source task reference.
task_source_type (TaskSourceType | str | None) – Type of task source.
element_iters (list[int] | None) – Originating element iterations.
where (Where | None) – Filtering rule.
- Return type:
Self
- task_ref#
Which task is this an input for? Used when the type is TASK.
- task_source_type#
Type of task source.
- to_json_like(dct=None, shared_data=None, exclude=(), 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.
- where: ElementFilter | None#
Filtering rules.