matflow.OutputFileParser#

class matflow.OutputFileParser(output_files, output=None, script=None, environment=None, inputs=None, outputs=None, options=None, script_pass_env_spec=False, abortable=False, save_files=True, clean_up=None, rules=None)#

Bases: OutputFileParser

Represents a script that is run to parse output files from an action and create outputs.

Parameters:
  • output_files (list[FileSpec]) – The output files that this parser will parse.

  • output (Parameter) – The singular output parsed by this parser. Not to be confused with outputs (plural).

  • script (str) – The name of the file containing the output file parser source.

  • environment (Environment) – The environment to use to run the parser.

  • inputs (list[str]) – The other inputs to the parser.

  • outputs (list[str]) – Optional multiple outputs from the upstream actions of the schema that are required to parametrise this parser.

  • options (dict) – Miscellaneous options.

  • script_pass_env_spec (bool) – Whether to pass the environment specifier to the script.

  • abortable (bool) – Whether this script can be aborted.

  • save_files (list[str]) – The files that should be saved to the persistent store for the workflow.

  • clean_files (list[str]) – The files that should be immediately removed.

  • rules (list[ActionRule]) – Rules for whether to enable this parser.

  • clean_up (List[str] | None) –

Methods

compose_source

Generate the file contents of this output file parser source.

from_json_like

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

get_action_rules

Get the rules that allow testing if this output file parser must be run or not for a given element.

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.

write_source

Write the actual output parser to a file so it can be enacted.

Attributes

abortable

Whether this script can be aborted.

app

clean_up

The files that should be immediately removed.

environment

The environment to use to run the parser.

inputs

The other inputs to the parser.

options

Miscellaneous options.

output

The singular output parsed by this parser.

outputs

Optional multiple outputs from the upstream actions of the schema that are required to parametrise this parser.

rules

Rules for whether to enable this parser.

save_files

The files that should be saved to the persistent store for the workflow.

script

The name of the file containing the output file parser source.

script_pass_env_spec

Whether to pass the environment specifier to the script.

output_files

The output files that this parser will parse.

abortable: bool | None = False#

Whether this script can be aborted.

app = App(name='MatFlow', version='0.3.0a132')#
clean_up: List[str] | None = None#

The files that should be immediately removed.

compose_source(snip_path)#

Generate the file contents of this output file parser source.

Return type:

str

environment: Environment = None#

The environment to use to run the parser.

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.

get_action_rules()#

Get the rules that allow testing if this output file parser must be run or not for a given element.

inputs: List[str] = None#

The other inputs to the parser.

options: Dict = None#

Miscellaneous options.

output: app.Parameter | None = None#

The singular output parsed by this parser. Not to be confused with outputs (plural).

output_files: List[app.FileSpec]#

The output files that this parser will parse.

outputs: List[str] = None#

Optional multiple outputs from the upstream actions of the schema that are required to parametrise this parser. Not to be confused with output (plural).

rules: List[app.ActionRule] | None = None#

Rules for whether to enable this parser.

save_files: List[str] | bool = True#

The files that should be saved to the persistent store for the workflow.

script: str = None#

The name of the file containing the output file parser source.

script_pass_env_spec: bool | None = False#

Whether to pass the environment specifier to the script.

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.

write_source(action, env_spec)#

Write the actual output parser to a file so it can be enacted.

Parameters:

env_spec (Dict[str, Any]) –