matflow.TaskSchema#

class matflow.TaskSchema(objective, actions=None, method=None, implementation=None, inputs=None, outputs=None, version=None, parameter_class_modules=None, web_doc=True, environment_presets=None, _hash_value=None)#

Bases: TaskSchema

Class to represent the inputs, outputs and implementation mechanism of a given task.

Parameters:
  • objective (TaskObjective | str) – This is a string representing the objective of the task schema.

  • actions (List[Action]) – A list of Action objects whose commands are to be executed by the task.

  • method (str | None) – An optional string to label the task schema by its method.

  • implementation (str | None) – An optional string to label the task schema by its implementation.

  • inputs (List[Parameter | SchemaInput] | None) – A list of SchemaInput objects that define the inputs to the task.

  • outputs (List[Parameter | SchemaOutput] | None) – A list of SchemaOutput objects that define the outputs of the task.

  • version (str | None) – The version of this task schema.

  • parameter_class_modules (List[str] | None) – Where to find implementations of parameter value handlers.

  • web_doc (bool | None) – True if this object should be included in the Sphinx documentation (normally only relevant for built-in task schemas). True by default.

  • environment_presets (Dict[str, Dict[str, Dict[str, Any]]] | None) – Information about default execution environments. Can be overridden in specific cases in the concrete tasks.

  • _hash_value (str | None) –

Methods

from_json_like

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

get_by_key

Get a config-loaded task schema from a key.

get_info_html

Describe the task schema as an HTML document.

get_key

Get the hashable value that represents this schema.

get_parameter_dependence

Find if/where a given parameter is used by the schema's actions.

ignore_invalid_actions

A context manager within which invalid actions will be ignored.

make_persistent

Convert this task schema to persistent form within the context of the given workflow.

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

basic_info

Show inputs and outputs, formatted in a table.

info

Show inputs, outputs, and actions, formatted in a table.

input_types

The input types to the schema.

multi_input_types

Get a list of input types that have multiple labels.

name

The name of this schema.

output_types

The output types from the schema.

provides_parameters

The parameters that this schema provides.

task_template

The template that this schema is contained in.

objective

This is a string representing the objective of the task schema.

actions

A list of Action objects whose commands are to be executed by the task.

method

An optional string to label the task schema by its method.

implementation

An optional string to label the task schema by its implementation.

inputs

A list of SchemaInput objects that define the inputs to the task.

outputs

A list of SchemaOutput objects that define the outputs of the task.

parameter_class_modules

Where to find implementations of parameter value handlers.

web_doc

Whether this object should be included in the Sphinx documentation (normally only relevant for built-in task schemas).

environment_presets

Information about default execution environments.

version

The version of this task schema.

actions#

A list of Action objects whose commands are to be executed by the task.

app = App(name='MatFlow', version='0.3.0a132')#
property basic_info#

Show inputs and outputs, formatted in a table.

environment_presets#

Information about default execution environments.

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.

classmethod get_by_key(key)#

Get a config-loaded task schema from a key.

get_info_html()#

Describe the task schema as an HTML document.

Return type:

str

get_key()#

Get the hashable value that represents this schema.

get_parameter_dependence(parameter)#

Find if/where a given parameter is used by the schema’s actions.

Parameters:

parameter (SchemaParameter) –

classmethod ignore_invalid_actions()#

A context manager within which invalid actions will be ignored.

implementation#

An optional string to label the task schema by its implementation.

property info#

Show inputs, outputs, and actions, formatted in a table.

property input_types#

The input types to the schema.

inputs#

A list of SchemaInput objects that define the inputs to the task.

make_persistent(workflow, source)#

Convert this task schema to persistent form within the context of the given workflow.

Parameters:
Return type:

List[int]

method#

An optional string to label the task schema by its method.

property multi_input_types: List[str]#

Get a list of input types that have multiple labels.

property name#

The name of this schema.

objective#

This is a string representing the objective of the task schema.

property output_types#

The output types from the schema.

outputs#

A list of SchemaOutput objects that define the outputs of the task.

parameter_class_modules#

Where to find implementations of parameter value handlers.

property provides_parameters: Tuple[Tuple[str, str]]#

The parameters that this schema provides.

property task_template#

The template that this schema is contained in.

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.

version#

The version of this task schema.

web_doc#

Whether this object should be included in the Sphinx documentation (normally only relevant for built-in task schemas).