hpcflow.sdk.core.command_files.InputFileGenerator#
- class hpcflow.sdk.core.command_files.InputFileGenerator(input_file, inputs, script=None, script_data_in=None, script_data_out=None, environment=None, script_pass_env_spec=False, jinja_template=None, jinja_template_path=None, abortable=False, rules=<factory>, requires_dir=True)#
Bases:
JSONLike
Represents a script that is run to generate input files for an action.
- Parameters:
input_file (FileSpec) – The file to generate.
inputs (list[Parameter]) – The input parameters to the generator.
script (str | None) – The script that generates the input.
environment (Environment | None) – The environment in which to run the generator.
script_pass_env_spec (bool) – Whether to pass in the environment.
abortable (bool) – Whether the generator can be stopped early. Quick-running scripts tend to not need this.
rules (list[ActionRule]) – User-specified rules for whether to run the generator.
script_data_in (str | Mapping[str, str | ActionData] | None)
script_data_out (str | Mapping[str, str | ActionData] | None)
jinja_template (str | None)
jinja_template_path (str | None)
requires_dir (bool)
Methods
Make an instance of this class from JSON (or YAML) data.
Get the rules that allow testing if this input file generator must be run or not for a given element.
Serialize this object as a dictionary.
Serialize this object as an object structure that can be trivially converted to JSON.
Attributes
Whether the generator can be stopped early.
The environment in which to run the generator.
The builtin path to a template that generates the input file.
The external path to a template that generates the input file.
Whether the generator requires a working directory.
The script that generates the inputs.
Information about data input to the script.
Information about data output from the script.
Whether to pass in the environment.
The file to generate.
The input parameters to the generator.
User-specified rules for whether to run the generator.
- abortable: bool = False#
Whether the generator can be stopped early. Quick-running scripts tend to not need this.
- environment: Environment | None = None#
The environment in which to run the generator.
- classmethod from_json_like(json_like, shared_data=None)#
Make an instance of this class from JSON (or YAML) data.
- Parameters:
json_like (str | Mapping[str, JSONed] | Sequence[Mapping[str, JSONed]] | None) – The data to deserialise.
shared_data (Mapping[str, ObjectList[JSONable]] | None) – Shared context data.
- Return type:
The deserialised object.
- get_action_rules()#
Get the rules that allow testing if this input file generator must be run or not for a given element.
- Return type:
- jinja_template_path: str | None = None#
The external path to a template that generates the input file.
- rules: list[ActionRule]#
User-specified rules for whether to run the generator.
- script_data_in: str | Mapping[str, str | ActionData] | None = None#
Information about data input to the script.
- script_data_out: str | Mapping[str, str | ActionData] | None = None#
Information about data output from the script.
- 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.