uwtools.api.rocoto

https://mybinder.org/badge_logo.svg

API access to uwtools Rocoto support.

uwtools.api.rocoto.iterate(cycle, database, task, workflow, rate=10)

Iterate the specified Rocoto workflow to completion (or failure).

Parameters:
  • cycle (datetime) – A datetime object to make available for use in the config.

  • database (Path | str) – Path to the Rocoto database file.

  • task (str) – The workflow task to iterate.

  • workflow (Path | str) – Path to the Rocoto XML workflow document.

  • rate (int) – Seconds between workflow iterations.

Return type:

bool

uwtools.api.rocoto.realize(config, output_file=None, key_path=None, stdin_ok=False)

Realize the Rocoto workflow defined in the given YAML as XML.

If no input file is specified, stdin is read. A YAMLConfig object may also be provided as input. If no output file is specified, stdout is written to. Both the input config and output Rocoto XML will be validated against appropriate schemas.

Parameters:
  • config (_YAMLConfig | Path | str | None) – YAML input file or YAMLConfig object (None => read stdin).

  • output_file (Path | str | None) – XML output file path (None => write to stdout).

  • key_path (list[YAMLKey] | None) – Path of keys to the Rocoto config block.

  • stdin_ok (bool) – OK to read from stdin?

Returns:

True.

Return type:

bool

uwtools.api.rocoto.validate_xml(xml_file=None, stdin_ok=False)

Validate purported Rocoto XML file against its schema.

Parameters:
  • xml_file (Path | str | None) – Path to XML file (None or unspecified => read stdin).

  • stdin_ok (bool) – OK to read from stdin?

Returns:

True if the XML conforms to the schema, False otherwise.

Return type:

bool