uwtools.api.execute

API support for interacting with external drivers.

uwtools.api.execute.execute(module, classname, task, schema_file=None, config=None, cycle=None, leadtime=None, batch=False, dry_run=False, graph_file=None, key_path=None, stdin_ok=False)

Execute a driver task.

If batch is specified and the driver is instructed to run, its runscript will be configured for and submitted to the batch system. Otherwise, the executable will be run directly on the current system.

Parameters:
  • module (Path | str) – Path to driver module or name of module on sys.path.

  • classname (str) – Name of driver class to instantiate.

  • task (str) – Name of driver task to execute.

  • schema_file (str | None) – The JSON Schema file to use for validation.

  • config (str | Path | None) – Path to config file (read stdin if missing or None).

  • cycle (datetime | None) – The cycle.

  • leadtime (timedelta | None) – The leadtime.

  • batch (bool | None) – Submit run to the batch system?

  • dry_run (bool | None) – Do not run the executable, just report what would have been done.

  • graph_file (str | Path | None) – Write Graphviz DOT output here.

  • key_path (list[str] | None) – Path of keys to subsection of config file.

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

Returns:

True if task completes without raising an exception.

Return type:

bool

uwtools.api.execute.graph()

Return Graphviz DOT code for the most recently executed task.

Return type:

str

uwtools.api.execute.tasks(module, classname)

Return a mapping from driver task names to their one-line descriptions.

Parameters:
  • module (Path | str) – Name of driver module.

  • classname (str) – Name of driver class to instantiate.

Return type:

dict[str, str]