hpcflow.sdk.core.commands.Command#
- class hpcflow.sdk.core.commands.Command(command=None, executable=None, arguments=None, variables=None, stdout=None, stderr=None, stdin=None, rules=<factory>)#
Bases:
JSONLike
A command that may be run within a workflow action.
- Parameters:
command (str) – The actual command.
executable (str) – The executable to run, from the set of executable managed by the environment.
variables (dict[str, str]) – Values that may be substituted when preparing the arguments.
stdout (str) – The name of a file to write standard output to.
stderr (str) – The name of a file to write standard error to.
stdin (str) – The name of a file to read standard input from.
rules (list[ActionRule]) – Rules that state whether this command is eligible to run.
Methods
Make an instance of this class from JSON (or YAML) data.
Return the resolved command line.
Get whether stdout and stderr are workflow parameters.
Return executable labels required by this command.
Process a description of a standard stread from a command to get how it becomes a workflow parameter for later actions.
Serialize this object as a dictionary.
Serialize this object as an object structure that can be trivially converted to JSON.
Attributes
The arguments to pass in.
The actual command.
The executable to run, from the set of executable managed by the environment.
The name of a file to write standard error to.
The name of a file to read standard input from.
The name of a file to write standard output to.
Values that may be substituted when preparing the arguments.
Rules that state whether this command is eligible to run.
- command: str | None = None#
The actual command. Overrides
executable
.
- executable: str | None = None#
The executable to run, from the set of executable managed by the environment.
- 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.
- get_command_line(EAR, shell, env)#
Return the resolved command line.
This is ordinarily called at run-time by Workflow.write_commands.
- get_output_types()#
Get whether stdout and stderr are workflow parameters.
- get_required_executables()#
Return executable labels required by this command.
- process_std_stream(name, value, stderr)#
Process a description of a standard stread from a command to get how it becomes a workflow parameter for later actions.
- rules: List[ActionRule] | None#
Rules that state whether this command is eligible to run.
- 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.