hpcflow.app.Command#

class hpcflow.app.Command(command=None, executable=None, arguments=None, variables=None, stdout=None, stderr=None, stdin=None, rules=<factory>)#

Bases: Command

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.

  • arguments (list[str]) – The arguments to pass in.

  • 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

from_json_like

Make an instance of this class from JSON (or YAML) data.

get_command_line

Return the resolved command line.

get_output_types

Get whether stdout and stderr are workflow parameters.

get_required_executables

Return executable labels required by this command.

process_std_stream

Process a description of a standard stread from a command to get how it becomes a workflow parameter for later actions.

to_dict

Serialize this object as a dictionary.

to_json_like

Serialize this object as an object structure that can be trivially converted to JSON.

Attributes

app

arguments

The arguments to pass in.

command

The actual command.

executable

The executable to run, from the set of executable managed by the environment.

stderr

The name of a file to write standard error to.

stdin

The name of a file to read standard input from.

stdout

The name of a file to write standard output to.

variables

Values that may be substituted when preparing the arguments.

rules

Rules that state whether this command is eligible to run.

app = BaseApp(name='hpcFlow', version='0.2.0a181')#
arguments: List[str] | None = None#

The arguments to pass in.

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.

Return type:

Tuple[str, List[Tuple[str, str]]]

get_output_types()#

Get whether stdout and stderr are workflow parameters.

get_required_executables()#

Return executable labels required by this command.

Return type:

List[str]

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.

Parameters:
  • name (str) – The name of the output, describing how to process things.

  • value (str) – The actual value read from the stream.

  • stderr (bool) – If true, this is handling the stderr stream. If false, the stdout stream.

rules: List[app.ActionRule] | None#

Rules that state whether this command is eligible to run.

stderr: str | None = None#

The name of a file to write standard error to.

stdin: str | None = None#

The name of a file to read standard input from.

stdout: str | None = None#

The name of a file to write standard output to.

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.

variables: Dict[str, str] | None = None#

Values that may be substituted when preparing the arguments.