From ab45222a110698b38afc2840bfaf6fefe979ff8f Mon Sep 17 00:00:00 2001 From: Paul Madden <136389411+maddenp-noaa@users.noreply.github.com> Date: Tue, 27 Aug 2024 07:33:16 -0600 Subject: [PATCH] Add --schema-file option to internal drivers (#592) --- docs/conf.py | 1 + docs/sections/user_guide/cli/Makefile | 2 +- docs/sections/user_guide/cli/drivers/Makefile | 9 +- .../user_guide/cli/drivers/cdeps/help.rst | 1 + .../drivers/{cdeps.rst => cdeps/index.rst} | 24 +---- .../user_guide/cli/drivers/cdeps/run-help.out | 4 +- .../cli/drivers/cdeps/schema-options.rst | 1 + .../cli/drivers/chgres_cube/help.rst | 1 + .../index.rst} | 24 +---- .../cli/drivers/chgres_cube/run-help.out | 5 +- .../drivers/chgres_cube/schema-options.rst | 1 + .../user_guide/cli/drivers/esg_grid/help.rst | 1 + .../{esg_grid.rst => esg_grid/index.rst} | 24 +---- .../cli/drivers/esg_grid/run-help.out | 5 +- .../cli/drivers/esg_grid/schema-options.rst | 1 + .../cli/drivers/filter_topo/help.rst | 1 + .../index.rst} | 24 +---- .../cli/drivers/filter_topo/run-help.out | 5 +- .../drivers/filter_topo/schema-options.rst | 1 + .../user_guide/cli/drivers/fv3/help.rst | 1 + .../cli/drivers/{fv3.rst => fv3/index.rst} | 24 +---- .../user_guide/cli/drivers/fv3/run-help.out | 5 +- .../cli/drivers/fv3/schema-options.rst | 1 + .../cli/drivers/global_equiv_resol/help.rst | 1 + .../index.rst} | 24 +---- .../drivers/global_equiv_resol/run-help.out | 6 +- .../global_equiv_resol/schema-options.rst | 1 + .../sections/user_guide/cli/drivers/index.rst | 36 +++---- .../user_guide/cli/drivers/ioda/help.rst | 1 + .../cli/drivers/{ioda.rst => ioda/index.rst} | 24 +---- .../user_guide/cli/drivers/ioda/run-help.out | 5 +- .../cli/drivers/ioda/schema-options.rst | 1 + .../user_guide/cli/drivers/jedi/help.rst | 1 + .../cli/drivers/{jedi.rst => jedi/index.rst} | 24 +---- .../user_guide/cli/drivers/jedi/run-help.out | 5 +- .../cli/drivers/jedi/schema-options.rst | 1 + .../cli/drivers/make_hgrid/help.rst | 1 + .../{make_hgrid.rst => make_hgrid/index.rst} | 28 +----- .../cli/drivers/make_hgrid/run-help.out | 5 +- .../cli/drivers/make_hgrid/schema-options.rst | 1 + .../cli/drivers/make_solo_mosaic/help.rst | 1 + .../index.rst} | 28 +----- .../cli/drivers/make_solo_mosaic/run-help.out | 5 +- .../make_solo_mosaic/schema-options.rst | 1 + .../user_guide/cli/drivers/mpas/help.rst | 1 + .../cli/drivers/{mpas.rst => mpas/index.rst} | 24 +---- .../user_guide/cli/drivers/mpas/run-help.out | 5 +- .../cli/drivers/mpas/schema-options.rst | 1 + .../user_guide/cli/drivers/mpas_init/help.rst | 1 + .../{mpas_init.rst => mpas_init/index.rst} | 24 +---- .../cli/drivers/mpas_init/run-help.out | 5 +- .../cli/drivers/mpas_init/schema-options.rst | 1 + .../user_guide/cli/drivers/orog/help.rst | 1 + .../cli/drivers/{orog.rst => orog/index.rst} | 24 +---- .../user_guide/cli/drivers/orog/run-help.out | 6 +- .../cli/drivers/orog/schema-options.rst | 1 + .../user_guide/cli/drivers/orog_gsl/help.rst | 1 + .../{orog_gsl.rst => orog_gsl/index.rst} | 24 +---- .../cli/drivers/orog_gsl/run-help.out | 5 +- .../cli/drivers/orog_gsl/schema-options.rst | 1 + .../cli/drivers/sfc_climo_gen/help.rst | 1 + .../index.rst} | 24 +---- .../cli/drivers/sfc_climo_gen/run-help.out | 5 +- .../drivers/sfc_climo_gen/schema-options.rst | 1 + .../user_guide/cli/drivers/shared/help.rst | 13 +++ .../cli/drivers}/shared/idempotent.rst | 0 .../cli/drivers/shared/schema-options.rst | 9 ++ .../user_guide/cli/drivers/shave/help.rst | 1 + .../drivers/{shave.rst => shave/index.rst} | 24 +---- .../user_guide/cli/drivers/shave/run-help.out | 4 +- .../cli/drivers/shave/schema-options.rst | 1 + .../user_guide/cli/drivers/ungrib/help.rst | 1 + .../drivers/{ungrib.rst => ungrib/index.rst} | 24 +---- .../cli/drivers/ungrib/run-help.out | 5 +- .../cli/drivers/ungrib/schema-options.rst | 1 + .../user_guide/cli/drivers/upp/help.rst | 1 + .../cli/drivers/{upp.rst => upp/index.rst} | 24 +---- .../user_guide/cli/drivers/upp/run-help.out | 6 +- .../cli/drivers/upp/schema-options.rst | 1 + .../cli/tools/config/validate-fail.out | 6 +- .../cli/tools/config/validate-pass-stdin.out | 2 +- .../cli/tools/config/validate-pass.out | 2 +- .../cli/tools/config/validate-verbose.out | 41 ++++---- .../sections/user_guide/cli/tools/execute.rst | 2 +- .../cli/tools/execute/alt-schema.out | 14 +-- .../user_guide/cli/tools/execute/execute.out | 14 +-- .../tools/fs/copy-exec-no-target-dir-err.out | 6 +- .../cli/tools/fs/copy-exec-timedep.out | 20 ++-- .../user_guide/cli/tools/fs/copy-exec.out | 30 +++--- .../tools/fs/link-exec-no-target-dir-err.out | 6 +- .../cli/tools/fs/link-exec-timedep.out | 20 ++-- .../user_guide/cli/tools/fs/link-exec.out | 30 +++--- .../fs/makedirs-exec-no-target-dir-err.out | 6 +- .../cli/tools/fs/makedirs-exec-timedep.out | 30 +++--- .../user_guide/cli/tools/fs/makedirs-exec.out | 30 +++--- .../cli/tools/rocoto/realize-exec-file.out | 4 +- .../rocoto/realize-exec-stdin-stdout.out | 4 +- .../rocoto/realize-exec-stdout-verbose.out | 40 ++++---- .../cli/tools/rocoto/realize-exec-stdout.out | 4 +- .../cli/tools/rocoto/validate-bad-file.out | 48 +++++----- .../cli/tools/rocoto/validate-good-file.out | 2 +- .../cli/tools/rocoto/validate-good-stdin.out | 2 +- src/uwtools/api/config.py | 1 + src/uwtools/api/execute.py | 2 +- src/uwtools/cli.py | 2 + src/uwtools/config/validator.py | 43 +++++---- src/uwtools/drivers/chgres_cube.py | 2 +- src/uwtools/drivers/driver.py | 43 +++++---- src/uwtools/drivers/esg_grid.py | 2 +- src/uwtools/drivers/filter_topo.py | 2 +- src/uwtools/drivers/fv3.py | 2 +- src/uwtools/drivers/mpas.py | 2 +- src/uwtools/drivers/mpas_init.py | 2 +- src/uwtools/drivers/sfc_climo_gen.py | 2 +- src/uwtools/drivers/upp.py | 2 +- src/uwtools/fs.py | 4 +- src/uwtools/rocoto.py | 4 +- src/uwtools/tests/api/test_config.py | 5 +- src/uwtools/tests/api/test_drivers.py | 1 + src/uwtools/tests/config/test_validator.py | 34 ++++--- src/uwtools/tests/drivers/test_driver.py | 94 +++++++++++-------- src/uwtools/tests/test_cli.py | 4 +- src/uwtools/tests/test_fs.py | 4 +- src/uwtools/tests/utils/test_api.py | 1 + src/uwtools/utils/api.py | 9 ++ 125 files changed, 561 insertions(+), 706 deletions(-) mode change 120000 => 100644 docs/sections/user_guide/cli/drivers/Makefile create mode 120000 docs/sections/user_guide/cli/drivers/cdeps/help.rst rename docs/sections/user_guide/cli/drivers/{cdeps.rst => cdeps/index.rst} (64%) create mode 120000 docs/sections/user_guide/cli/drivers/cdeps/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/chgres_cube/help.rst rename docs/sections/user_guide/cli/drivers/{chgres_cube.rst => chgres_cube/index.rst} (76%) create mode 120000 docs/sections/user_guide/cli/drivers/chgres_cube/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/esg_grid/help.rst rename docs/sections/user_guide/cli/drivers/{esg_grid.rst => esg_grid/index.rst} (74%) create mode 120000 docs/sections/user_guide/cli/drivers/esg_grid/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/filter_topo/help.rst rename docs/sections/user_guide/cli/drivers/{filter_topo.rst => filter_topo/index.rst} (69%) create mode 120000 docs/sections/user_guide/cli/drivers/filter_topo/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/fv3/help.rst rename docs/sections/user_guide/cli/drivers/{fv3.rst => fv3/index.rst} (75%) create mode 120000 docs/sections/user_guide/cli/drivers/fv3/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/global_equiv_resol/help.rst rename docs/sections/user_guide/cli/drivers/{global_equiv_resol.rst => global_equiv_resol/index.rst} (69%) create mode 120000 docs/sections/user_guide/cli/drivers/global_equiv_resol/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/ioda/help.rst rename docs/sections/user_guide/cli/drivers/{ioda.rst => ioda/index.rst} (69%) create mode 120000 docs/sections/user_guide/cli/drivers/ioda/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/jedi/help.rst rename docs/sections/user_guide/cli/drivers/{jedi.rst => jedi/index.rst} (68%) create mode 120000 docs/sections/user_guide/cli/drivers/jedi/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/make_hgrid/help.rst rename docs/sections/user_guide/cli/drivers/{make_hgrid.rst => make_hgrid/index.rst} (67%) create mode 120000 docs/sections/user_guide/cli/drivers/make_hgrid/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/make_solo_mosaic/help.rst rename docs/sections/user_guide/cli/drivers/{make_solo_mosaic.rst => make_solo_mosaic/index.rst} (67%) create mode 120000 docs/sections/user_guide/cli/drivers/make_solo_mosaic/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/mpas/help.rst rename docs/sections/user_guide/cli/drivers/{mpas.rst => mpas/index.rst} (77%) create mode 120000 docs/sections/user_guide/cli/drivers/mpas/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/mpas_init/help.rst rename docs/sections/user_guide/cli/drivers/{mpas_init.rst => mpas_init/index.rst} (77%) create mode 120000 docs/sections/user_guide/cli/drivers/mpas_init/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/orog/help.rst rename docs/sections/user_guide/cli/drivers/{orog.rst => orog/index.rst} (68%) create mode 120000 docs/sections/user_guide/cli/drivers/orog/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/orog_gsl/help.rst rename docs/sections/user_guide/cli/drivers/{orog_gsl.rst => orog_gsl/index.rst} (69%) create mode 120000 docs/sections/user_guide/cli/drivers/orog_gsl/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/sfc_climo_gen/help.rst rename docs/sections/user_guide/cli/drivers/{sfc_climo_gen.rst => sfc_climo_gen/index.rst} (74%) create mode 120000 docs/sections/user_guide/cli/drivers/sfc_climo_gen/schema-options.rst create mode 100644 docs/sections/user_guide/cli/drivers/shared/help.rst rename docs/{ => sections/user_guide/cli/drivers}/shared/idempotent.rst (100%) create mode 100644 docs/sections/user_guide/cli/drivers/shared/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/shave/help.rst rename docs/sections/user_guide/cli/drivers/{shave.rst => shave/index.rst} (69%) create mode 120000 docs/sections/user_guide/cli/drivers/shave/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/ungrib/help.rst rename docs/sections/user_guide/cli/drivers/{ungrib.rst => ungrib/index.rst} (75%) create mode 120000 docs/sections/user_guide/cli/drivers/ungrib/schema-options.rst create mode 120000 docs/sections/user_guide/cli/drivers/upp/help.rst rename docs/sections/user_guide/cli/drivers/{upp.rst => upp/index.rst} (76%) create mode 120000 docs/sections/user_guide/cli/drivers/upp/schema-options.rst diff --git a/docs/conf.py b/docs/conf.py index 0087720b5..23a829e62 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,6 +14,7 @@ autodoc_mock_imports = ["f90nml", "iotaa", "jsonschema", "lxml", "referencing"] autodoc_typehints = "description" copyright = str(dt.datetime.now().year) +exclude_patterns = ["**/shared/*.rst"] extensions = ["sphinx.ext.autodoc", "sphinx.ext.extlinks", "sphinx.ext.intersphinx"] extlinks_detect_hardcoded_links = True html_logo = os.path.join("static", "ufs.png") diff --git a/docs/sections/user_guide/cli/Makefile b/docs/sections/user_guide/cli/Makefile index 0e58d33d6..5bffc855c 100644 --- a/docs/sections/user_guide/cli/Makefile +++ b/docs/sections/user_guide/cli/Makefile @@ -1,4 +1,4 @@ -SUBDIRS = $(shell find . -maxdepth 1 -mindepth 1 -type d) +SUBDIRS = $(shell find . -maxdepth 1 -mindepth 1 -type d | sort) .PHONY: all $(SUBDIRS) diff --git a/docs/sections/user_guide/cli/drivers/Makefile b/docs/sections/user_guide/cli/drivers/Makefile deleted file mode 120000 index d0b0e8e00..000000000 --- a/docs/sections/user_guide/cli/drivers/Makefile +++ /dev/null @@ -1 +0,0 @@ -../Makefile \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/Makefile b/docs/sections/user_guide/cli/drivers/Makefile new file mode 100644 index 000000000..9cd3e68f6 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/Makefile @@ -0,0 +1,8 @@ +SUBDIRS = $(filter-out ./shared,$(shell find . -maxdepth 1 -mindepth 1 -type d | sort)) + +.PHONY: all $(SUBDIRS) + +all: $(SUBDIRS) + +$(SUBDIRS): + $(MAKE) -C $@ -j diff --git a/docs/sections/user_guide/cli/drivers/cdeps/help.rst b/docs/sections/user_guide/cli/drivers/cdeps/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/cdeps/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/cdeps.rst b/docs/sections/user_guide/cli/drivers/cdeps/index.rst similarity index 64% rename from docs/sections/user_guide/cli/drivers/cdeps.rst rename to docs/sections/user_guide/cli/drivers/cdeps/index.rst index 1044ad6c6..c24fa84b4 100644 --- a/docs/sections/user_guide/cli/drivers/cdeps.rst +++ b/docs/sections/user_guide/cli/drivers/cdeps/index.rst @@ -1,23 +1,11 @@ ``cdeps`` ========= -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the :CDEPS:`cdeps<>` component. -.. literalinclude:: cdeps/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: cdeps/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: cdeps/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: cdeps/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -45,10 +33,4 @@ Its contents are described in depth in section :ref:`cdeps_yaml`. Each of the va .. include:: /shared/key_path.rst -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: cdeps/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: cdeps/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/cdeps/run-help.out b/docs/sections/user_guide/cli/drivers/cdeps/run-help.out index 7ddba5ecc..abe05b455 100644 --- a/docs/sections/user_guide/cli/drivers/cdeps/run-help.out +++ b/docs/sections/user_guide/cli/drivers/cdeps/run-help.out @@ -1,6 +1,6 @@ usage: uw cdeps atm --cycle CYCLE [-h] [--version] [--config-file PATH] [--dry-run] [--graph-file PATH] [--key-path KEY[.KEY...]] - [--quiet] [--verbose] + [--schema-file PATH] [--quiet] [--verbose] The data atmosphere configuration with all required content @@ -22,6 +22,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/cdeps/schema-options.rst b/docs/sections/user_guide/cli/drivers/cdeps/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/cdeps/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/chgres_cube/help.rst b/docs/sections/user_guide/cli/drivers/chgres_cube/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/chgres_cube/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/chgres_cube.rst b/docs/sections/user_guide/cli/drivers/chgres_cube/index.rst similarity index 76% rename from docs/sections/user_guide/cli/drivers/chgres_cube.rst rename to docs/sections/user_guide/cli/drivers/chgres_cube/index.rst index 6d954a1c6..1c0d960ff 100644 --- a/docs/sections/user_guide/cli/drivers/chgres_cube.rst +++ b/docs/sections/user_guide/cli/drivers/chgres_cube/index.rst @@ -1,23 +1,11 @@ ``chgres_cube`` =============== -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the :ufs-utils:`chgres_cube` component. -.. literalinclude:: chgres_cube/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: chgres_cube/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: chgres_cube/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: chgres_cube/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -59,10 +47,4 @@ Its contents are described in depth in section :ref:`chgres_cube_yaml`. Each of $ uw chgres_cube provisioned_rundir --config-file config.yaml --cycle 2023-12-15T18 --batch -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: chgres_cube/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: chgres_cube/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/chgres_cube/run-help.out b/docs/sections/user_guide/cli/drivers/chgres_cube/run-help.out index e4a817eb0..70c20c78a 100644 --- a/docs/sections/user_guide/cli/drivers/chgres_cube/run-help.out +++ b/docs/sections/user_guide/cli/drivers/chgres_cube/run-help.out @@ -1,6 +1,7 @@ usage: uw chgres_cube run --cycle CYCLE [-h] [--version] [--config-file PATH] [--batch] [--dry-run] [--graph-file PATH] - [--key-path KEY[.KEY...]] [--quiet] [--verbose] + [--key-path KEY[.KEY...]] [--schema-file PATH] + [--quiet] [--verbose] A run @@ -24,6 +25,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/chgres_cube/schema-options.rst b/docs/sections/user_guide/cli/drivers/chgres_cube/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/chgres_cube/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/esg_grid/help.rst b/docs/sections/user_guide/cli/drivers/esg_grid/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/esg_grid/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/esg_grid.rst b/docs/sections/user_guide/cli/drivers/esg_grid/index.rst similarity index 74% rename from docs/sections/user_guide/cli/drivers/esg_grid.rst rename to docs/sections/user_guide/cli/drivers/esg_grid/index.rst index e04e8af80..9bad1de34 100644 --- a/docs/sections/user_guide/cli/drivers/esg_grid.rst +++ b/docs/sections/user_guide/cli/drivers/esg_grid/index.rst @@ -1,23 +1,11 @@ ``esg_grid`` ============ -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the :ufs-utils:`regional_esg_grid` component. -.. literalinclude:: esg_grid/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: esg_grid/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: esg_grid/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: esg_grid/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -59,10 +47,4 @@ The driver creates a ``runscript.esg_grid`` file in the directory specified by ` $ uw esg_grid provisioned_rundir --config-file config.yaml --batch -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: esg_grid/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: esg_grid/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/esg_grid/run-help.out b/docs/sections/user_guide/cli/drivers/esg_grid/run-help.out index 27163b2ff..94eeee88b 100644 --- a/docs/sections/user_guide/cli/drivers/esg_grid/run-help.out +++ b/docs/sections/user_guide/cli/drivers/esg_grid/run-help.out @@ -1,6 +1,7 @@ usage: uw esg_grid run [-h] [--version] [--config-file PATH] [--batch] [--dry-run] [--graph-file PATH] - [--key-path KEY[.KEY...]] [--quiet] [--verbose] + [--key-path KEY[.KEY...]] [--schema-file PATH] + [--quiet] [--verbose] A run @@ -20,6 +21,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/esg_grid/schema-options.rst b/docs/sections/user_guide/cli/drivers/esg_grid/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/esg_grid/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/filter_topo/help.rst b/docs/sections/user_guide/cli/drivers/filter_topo/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/filter_topo/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/filter_topo.rst b/docs/sections/user_guide/cli/drivers/filter_topo/index.rst similarity index 69% rename from docs/sections/user_guide/cli/drivers/filter_topo.rst rename to docs/sections/user_guide/cli/drivers/filter_topo/index.rst index a7a77ff5d..58eb2844f 100644 --- a/docs/sections/user_guide/cli/drivers/filter_topo.rst +++ b/docs/sections/user_guide/cli/drivers/filter_topo/index.rst @@ -1,23 +1,11 @@ ``filter_topo`` =============== -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the UFS Utils preprocessing component ``filter_topo``. Documentation for this UFS Utils component is :ufs-utils:`here `. -.. literalinclude:: filter_topo/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: filter_topo/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: filter_topo/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: filter_topo/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -53,10 +41,4 @@ Its contents are described in section :ref:`filter_topo_yaml`. .. include:: /shared/key_path.rst -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: filter_topo/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: filter_topo/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/filter_topo/run-help.out b/docs/sections/user_guide/cli/drivers/filter_topo/run-help.out index 0ba5caf14..95604d511 100644 --- a/docs/sections/user_guide/cli/drivers/filter_topo/run-help.out +++ b/docs/sections/user_guide/cli/drivers/filter_topo/run-help.out @@ -1,6 +1,7 @@ usage: uw filter_topo run [-h] [--version] [--config-file PATH] [--batch] [--dry-run] [--graph-file PATH] - [--key-path KEY[.KEY...]] [--quiet] [--verbose] + [--key-path KEY[.KEY...]] [--schema-file PATH] + [--quiet] [--verbose] A run @@ -20,6 +21,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/filter_topo/schema-options.rst b/docs/sections/user_guide/cli/drivers/filter_topo/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/filter_topo/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/fv3/help.rst b/docs/sections/user_guide/cli/drivers/fv3/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/fv3/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/fv3.rst b/docs/sections/user_guide/cli/drivers/fv3/index.rst similarity index 75% rename from docs/sections/user_guide/cli/drivers/fv3.rst rename to docs/sections/user_guide/cli/drivers/fv3/index.rst index c601d7464..3bf2d91ad 100644 --- a/docs/sections/user_guide/cli/drivers/fv3.rst +++ b/docs/sections/user_guide/cli/drivers/fv3/index.rst @@ -1,23 +1,11 @@ ``fv3`` ======= -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running FV3. -.. literalinclude:: fv3/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: fv3/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: fv3/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: fv3/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -54,10 +42,4 @@ The examples use a configuration file named ``config.yaml``. Its contents are de $ uw fv3 provisioned_rundir --config-file config.yaml --cycle 2024-02-11T12 --batch -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: fv3/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: fv3/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/fv3/run-help.out b/docs/sections/user_guide/cli/drivers/fv3/run-help.out index cb1c1d124..e56710a4d 100644 --- a/docs/sections/user_guide/cli/drivers/fv3/run-help.out +++ b/docs/sections/user_guide/cli/drivers/fv3/run-help.out @@ -1,6 +1,7 @@ usage: uw fv3 run --cycle CYCLE [-h] [--version] [--config-file PATH] [--batch] [--dry-run] [--graph-file PATH] - [--key-path KEY[.KEY...]] [--quiet] [--verbose] + [--key-path KEY[.KEY...]] [--schema-file PATH] [--quiet] + [--verbose] A run @@ -24,6 +25,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/fv3/schema-options.rst b/docs/sections/user_guide/cli/drivers/fv3/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/fv3/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/global_equiv_resol/help.rst b/docs/sections/user_guide/cli/drivers/global_equiv_resol/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/global_equiv_resol/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/global_equiv_resol.rst b/docs/sections/user_guide/cli/drivers/global_equiv_resol/index.rst similarity index 69% rename from docs/sections/user_guide/cli/drivers/global_equiv_resol.rst rename to docs/sections/user_guide/cli/drivers/global_equiv_resol/index.rst index f02e99760..31af8faf1 100644 --- a/docs/sections/user_guide/cli/drivers/global_equiv_resol.rst +++ b/docs/sections/user_guide/cli/drivers/global_equiv_resol/index.rst @@ -1,23 +1,11 @@ ``global_equiv_resol`` ====================== -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the UFS Utils preprocessing component ``global_equiv_resol``. Documentation for this UFS Utils component is :ufs-utils:`here `. -.. literalinclude:: global_equiv_resol/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: global_equiv_resol/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: global_equiv_resol/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: global_equiv_resol/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -53,10 +41,4 @@ Its contents are described in section :ref:`global_equiv_resol_yaml`. .. include:: /shared/key_path.rst -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: global_equiv_resol/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: global_equiv_resol/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/global_equiv_resol/run-help.out b/docs/sections/user_guide/cli/drivers/global_equiv_resol/run-help.out index 497807855..5e6e9a84e 100644 --- a/docs/sections/user_guide/cli/drivers/global_equiv_resol/run-help.out +++ b/docs/sections/user_guide/cli/drivers/global_equiv_resol/run-help.out @@ -1,7 +1,7 @@ usage: uw global_equiv_resol run [-h] [--version] [--config-file PATH] [--batch] [--dry-run] [--graph-file PATH] - [--key-path KEY[.KEY...]] [--quiet] - [--verbose] + [--key-path KEY[.KEY...]] + [--schema-file PATH] [--quiet] [--verbose] A run @@ -21,6 +21,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/global_equiv_resol/schema-options.rst b/docs/sections/user_guide/cli/drivers/global_equiv_resol/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/global_equiv_resol/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/index.rst b/docs/sections/user_guide/cli/drivers/index.rst index f32514cf2..be5a913c0 100644 --- a/docs/sections/user_guide/cli/drivers/index.rst +++ b/docs/sections/user_guide/cli/drivers/index.rst @@ -6,21 +6,21 @@ Drivers .. toctree:: :maxdepth: 1 - cdeps - chgres_cube - esg_grid - filter_topo - fv3 - global_equiv_resol - ioda - jedi - make_hgrid - make_solo_mosaic - mpas - mpas_init - orog - orog_gsl - sfc_climo_gen - shave - ungrib - upp + cdeps/index + chgres_cube/index + esg_grid/index + filter_topo/index + fv3/index + global_equiv_resol/index + ioda/index + jedi/index + make_hgrid/index + make_solo_mosaic/index + mpas/index + mpas_init/index + orog/index + orog_gsl/index + sfc_climo_gen/index + shave/index + ungrib/index + upp/index diff --git a/docs/sections/user_guide/cli/drivers/ioda/help.rst b/docs/sections/user_guide/cli/drivers/ioda/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/ioda/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/ioda.rst b/docs/sections/user_guide/cli/drivers/ioda/index.rst similarity index 69% rename from docs/sections/user_guide/cli/drivers/ioda.rst rename to docs/sections/user_guide/cli/drivers/ioda/index.rst index 9ea6e745c..2d33d173b 100644 --- a/docs/sections/user_guide/cli/drivers/ioda.rst +++ b/docs/sections/user_guide/cli/drivers/ioda/index.rst @@ -1,23 +1,11 @@ ``ioda`` ======== -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the IODA components of the JEDI framework. -.. literalinclude:: ioda/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: ioda/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: ioda/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: ioda/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -53,10 +41,4 @@ The driver creates a ``runscript.ioda`` file in the directory specified by ``run .. include:: /shared/key_path.rst -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: ioda/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: ioda/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/ioda/run-help.out b/docs/sections/user_guide/cli/drivers/ioda/run-help.out index fcbe6dd72..43e297ce0 100644 --- a/docs/sections/user_guide/cli/drivers/ioda/run-help.out +++ b/docs/sections/user_guide/cli/drivers/ioda/run-help.out @@ -1,6 +1,7 @@ usage: uw ioda run --cycle CYCLE [-h] [--version] [--config-file PATH] [--batch] [--dry-run] [--graph-file PATH] - [--key-path KEY[.KEY...]] [--quiet] [--verbose] + [--key-path KEY[.KEY...]] [--schema-file PATH] [--quiet] + [--verbose] A run @@ -24,6 +25,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/ioda/schema-options.rst b/docs/sections/user_guide/cli/drivers/ioda/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/ioda/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/jedi/help.rst b/docs/sections/user_guide/cli/drivers/jedi/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/jedi/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/jedi.rst b/docs/sections/user_guide/cli/drivers/jedi/index.rst similarity index 68% rename from docs/sections/user_guide/cli/drivers/jedi.rst rename to docs/sections/user_guide/cli/drivers/jedi/index.rst index 464300b94..57682264a 100644 --- a/docs/sections/user_guide/cli/drivers/jedi.rst +++ b/docs/sections/user_guide/cli/drivers/jedi/index.rst @@ -1,23 +1,11 @@ ``jedi`` ======== -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the JEDI framework. -.. literalinclude:: jedi/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: jedi/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: jedi/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: jedi/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -53,10 +41,4 @@ The driver creates a ``runscript.jedi`` file in the directory specified by ``run .. include:: /shared/key_path.rst -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: jedi/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: jedi/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/jedi/run-help.out b/docs/sections/user_guide/cli/drivers/jedi/run-help.out index 242e6185c..aa75b918a 100644 --- a/docs/sections/user_guide/cli/drivers/jedi/run-help.out +++ b/docs/sections/user_guide/cli/drivers/jedi/run-help.out @@ -1,6 +1,7 @@ usage: uw jedi run --cycle CYCLE [-h] [--version] [--config-file PATH] [--batch] [--dry-run] [--graph-file PATH] - [--key-path KEY[.KEY...]] [--quiet] [--verbose] + [--key-path KEY[.KEY...]] [--schema-file PATH] [--quiet] + [--verbose] A run @@ -24,6 +25,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/jedi/schema-options.rst b/docs/sections/user_guide/cli/drivers/jedi/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/jedi/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/make_hgrid/help.rst b/docs/sections/user_guide/cli/drivers/make_hgrid/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/make_hgrid/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/make_hgrid.rst b/docs/sections/user_guide/cli/drivers/make_hgrid/index.rst similarity index 67% rename from docs/sections/user_guide/cli/drivers/make_hgrid.rst rename to docs/sections/user_guide/cli/drivers/make_hgrid/index.rst index dc6d79dd3..95cb9b43f 100644 --- a/docs/sections/user_guide/cli/drivers/make_hgrid.rst +++ b/docs/sections/user_guide/cli/drivers/make_hgrid/index.rst @@ -1,23 +1,11 @@ ``make_hgrid`` ============== -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the UFS Utils preprocessing component ``make_hgrid``. Documentation for this UFS Utils component is :ufs-utils:`here `. -.. literalinclude:: make_hgrid/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: make_hgrid/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: make_hgrid/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: make_hgrid/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -39,10 +27,10 @@ Its contents are described in section :ref:`make_hgrid_yaml`. An example runscript: - .. literalinclude:: make_hgrid/runscript.cmd + .. literalinclude:: runscript.cmd :language: text :emphasize-lines: 5 - .. literalinclude:: make_hgrid/runscript.out + .. literalinclude:: runscript.out :language: text * Run ``make_hgrid`` via a batch job @@ -61,10 +49,4 @@ Its contents are described in section :ref:`make_hgrid_yaml`. .. include:: /shared/key_path.rst -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: make_hgrid/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: make_hgrid/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/make_hgrid/run-help.out b/docs/sections/user_guide/cli/drivers/make_hgrid/run-help.out index bf4c684d9..76ad2d63b 100644 --- a/docs/sections/user_guide/cli/drivers/make_hgrid/run-help.out +++ b/docs/sections/user_guide/cli/drivers/make_hgrid/run-help.out @@ -1,6 +1,7 @@ usage: uw make_hgrid run [-h] [--version] [--config-file PATH] [--batch] [--dry-run] [--graph-file PATH] - [--key-path KEY[.KEY...]] [--quiet] [--verbose] + [--key-path KEY[.KEY...]] [--schema-file PATH] + [--quiet] [--verbose] A run @@ -20,6 +21,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/make_hgrid/schema-options.rst b/docs/sections/user_guide/cli/drivers/make_hgrid/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/make_hgrid/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/make_solo_mosaic/help.rst b/docs/sections/user_guide/cli/drivers/make_solo_mosaic/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/make_solo_mosaic/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/make_solo_mosaic.rst b/docs/sections/user_guide/cli/drivers/make_solo_mosaic/index.rst similarity index 67% rename from docs/sections/user_guide/cli/drivers/make_solo_mosaic.rst rename to docs/sections/user_guide/cli/drivers/make_solo_mosaic/index.rst index 7d110acad..f5fc55d25 100644 --- a/docs/sections/user_guide/cli/drivers/make_solo_mosaic.rst +++ b/docs/sections/user_guide/cli/drivers/make_solo_mosaic/index.rst @@ -1,23 +1,11 @@ ``make_solo_mosaic`` ==================== -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the UFS Utils preprocessing component ``make_solo_mosaic``. Documentation for this UFS Utils component is :ufs-utils:`here `. -.. literalinclude:: make_solo_mosaic/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: make_solo_mosaic/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: make_solo_mosaic/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: make_solo_mosaic/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -40,10 +28,10 @@ Its contents are described in section :ref:`make_solo_mosaic_yaml`. .. An example runscript: - .. literalinclude:: make_solo_mosaic/runscript.cmd + .. literalinclude:: runscript.cmd :language: text :emphasize-lines: 5 - .. literalinclude:: make_solo_mosaic/runscript.out + .. literalinclude:: runscript.out :language: text * Run ``make_solo_mosaic`` via a batch job @@ -62,10 +50,4 @@ Its contents are described in section :ref:`make_solo_mosaic_yaml`. .. include:: /shared/key_path.rst -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: make_solo_mosaic/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: make_solo_mosaic/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/make_solo_mosaic/run-help.out b/docs/sections/user_guide/cli/drivers/make_solo_mosaic/run-help.out index 843caecf8..203357701 100644 --- a/docs/sections/user_guide/cli/drivers/make_solo_mosaic/run-help.out +++ b/docs/sections/user_guide/cli/drivers/make_solo_mosaic/run-help.out @@ -1,6 +1,7 @@ usage: uw make_solo_mosaic run [-h] [--version] [--config-file PATH] [--batch] [--dry-run] [--graph-file PATH] - [--key-path KEY[.KEY...]] [--quiet] [--verbose] + [--key-path KEY[.KEY...]] [--schema-file PATH] + [--quiet] [--verbose] A run @@ -20,6 +21,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/make_solo_mosaic/schema-options.rst b/docs/sections/user_guide/cli/drivers/make_solo_mosaic/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/make_solo_mosaic/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/mpas/help.rst b/docs/sections/user_guide/cli/drivers/mpas/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/mpas/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/mpas.rst b/docs/sections/user_guide/cli/drivers/mpas/index.rst similarity index 77% rename from docs/sections/user_guide/cli/drivers/mpas.rst rename to docs/sections/user_guide/cli/drivers/mpas/index.rst index 090d50a92..6b7a86dfa 100644 --- a/docs/sections/user_guide/cli/drivers/mpas.rst +++ b/docs/sections/user_guide/cli/drivers/mpas/index.rst @@ -1,23 +1,11 @@ ``mpas`` ========== -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the MPAS forecast model. Each listed ``TASK`` may be called to generate the runtime asset(s) it is responsible for, and will call any task it depends on as needed. A ``provisioned_rundir`` comprises everything needed for a run, and a ``run`` runs the MPAS executable. -.. literalinclude:: mpas/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: mpas/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: mpas/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: mpas/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -59,10 +47,4 @@ Its contents are described in depth in section :ref:`mpas_yaml`. $ uw mpas provisioned_rundir --config-file config.yaml --cycle 2025-02-12T12 --batch -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: mpas/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: mpas/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/mpas/run-help.out b/docs/sections/user_guide/cli/drivers/mpas/run-help.out index 5a5ffb83f..54d66f963 100644 --- a/docs/sections/user_guide/cli/drivers/mpas/run-help.out +++ b/docs/sections/user_guide/cli/drivers/mpas/run-help.out @@ -1,6 +1,7 @@ usage: uw mpas run --cycle CYCLE [-h] [--version] [--config-file PATH] [--batch] [--dry-run] [--graph-file PATH] - [--key-path KEY[.KEY...]] [--quiet] [--verbose] + [--key-path KEY[.KEY...]] [--schema-file PATH] [--quiet] + [--verbose] A run @@ -24,6 +25,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/mpas/schema-options.rst b/docs/sections/user_guide/cli/drivers/mpas/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/mpas/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/mpas_init/help.rst b/docs/sections/user_guide/cli/drivers/mpas_init/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/mpas_init/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/mpas_init.rst b/docs/sections/user_guide/cli/drivers/mpas_init/index.rst similarity index 77% rename from docs/sections/user_guide/cli/drivers/mpas_init.rst rename to docs/sections/user_guide/cli/drivers/mpas_init/index.rst index b8286a929..6a2bd9517 100644 --- a/docs/sections/user_guide/cli/drivers/mpas_init.rst +++ b/docs/sections/user_guide/cli/drivers/mpas_init/index.rst @@ -1,23 +1,11 @@ ``mpas_init`` ============= -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the MPAS ``init_atmosphere`` tool. Each listed ``TASK`` may be called to generate the runtime asset(s) it is responsible for, and will call any task it depends on as needed. A ``provisioned_rundir`` comprises everything needed for a run, and a ``run`` runs the ``init_atmosphere`` executable. -.. literalinclude:: mpas_init/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: mpas_init/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: mpas_init/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: mpas_init/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -59,10 +47,4 @@ Its contents are described in depth in section :ref:`mpas_init_yaml`. $ uw mpas_init provisioned_rundir --config-file config.yaml --cycle 2023-12-18T00 --batch -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: mpas_init/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: mpas_init/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/mpas_init/run-help.out b/docs/sections/user_guide/cli/drivers/mpas_init/run-help.out index 53424102b..c9682821e 100644 --- a/docs/sections/user_guide/cli/drivers/mpas_init/run-help.out +++ b/docs/sections/user_guide/cli/drivers/mpas_init/run-help.out @@ -1,6 +1,7 @@ usage: uw mpas_init run --cycle CYCLE [-h] [--version] [--config-file PATH] [--batch] [--dry-run] [--graph-file PATH] - [--key-path KEY[.KEY...]] [--quiet] [--verbose] + [--key-path KEY[.KEY...]] [--schema-file PATH] + [--quiet] [--verbose] A run @@ -24,6 +25,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/mpas_init/schema-options.rst b/docs/sections/user_guide/cli/drivers/mpas_init/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/mpas_init/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/orog/help.rst b/docs/sections/user_guide/cli/drivers/orog/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/orog/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/orog.rst b/docs/sections/user_guide/cli/drivers/orog/index.rst similarity index 68% rename from docs/sections/user_guide/cli/drivers/orog.rst rename to docs/sections/user_guide/cli/drivers/orog/index.rst index 599c4a020..77f16009c 100644 --- a/docs/sections/user_guide/cli/drivers/orog.rst +++ b/docs/sections/user_guide/cli/drivers/orog/index.rst @@ -1,23 +1,11 @@ ``orog`` ======== -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the UFS Utils preprocessing component ``orog``. -.. literalinclude:: orog/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: orog/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: orog/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: orog/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -53,10 +41,4 @@ Its contents are described in section :ref:`orog_yaml`. .. include:: /shared/key_path.rst -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: orog/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: orog/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/orog/run-help.out b/docs/sections/user_guide/cli/drivers/orog/run-help.out index 833c52f8e..3a2bd47d8 100644 --- a/docs/sections/user_guide/cli/drivers/orog/run-help.out +++ b/docs/sections/user_guide/cli/drivers/orog/run-help.out @@ -1,6 +1,6 @@ usage: uw orog run [-h] [--version] [--config-file PATH] [--batch] [--dry-run] - [--graph-file PATH] [--key-path KEY[.KEY...]] [--quiet] - [--verbose] + [--graph-file PATH] [--key-path KEY[.KEY...]] + [--schema-file PATH] [--quiet] [--verbose] A run @@ -20,6 +20,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/orog/schema-options.rst b/docs/sections/user_guide/cli/drivers/orog/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/orog/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/orog_gsl/help.rst b/docs/sections/user_guide/cli/drivers/orog_gsl/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/orog_gsl/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/orog_gsl.rst b/docs/sections/user_guide/cli/drivers/orog_gsl/index.rst similarity index 69% rename from docs/sections/user_guide/cli/drivers/orog_gsl.rst rename to docs/sections/user_guide/cli/drivers/orog_gsl/index.rst index d589651b6..086b66018 100644 --- a/docs/sections/user_guide/cli/drivers/orog_gsl.rst +++ b/docs/sections/user_guide/cli/drivers/orog_gsl/index.rst @@ -1,23 +1,11 @@ ``orog_gsl`` ============ -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the UFS Utils preprocessing component ``orog_gsl``. Documentation for this UFS Utils component is :ufs-utils:`here `. -.. literalinclude:: orog_gsl/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: orog_gsl/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: orog_gsl/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: orog_gsl/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -53,10 +41,4 @@ Its contents are described in section :ref:`orog_gsl_yaml`. .. include:: /shared/key_path.rst -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: orog_gsl/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: orog_gsl/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/orog_gsl/run-help.out b/docs/sections/user_guide/cli/drivers/orog_gsl/run-help.out index 5601cf270..ff7a8e7fe 100644 --- a/docs/sections/user_guide/cli/drivers/orog_gsl/run-help.out +++ b/docs/sections/user_guide/cli/drivers/orog_gsl/run-help.out @@ -1,6 +1,7 @@ usage: uw orog_gsl run [-h] [--version] [--config-file PATH] [--batch] [--dry-run] [--graph-file PATH] - [--key-path KEY[.KEY...]] [--quiet] [--verbose] + [--key-path KEY[.KEY...]] [--schema-file PATH] + [--quiet] [--verbose] A run @@ -20,6 +21,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/orog_gsl/schema-options.rst b/docs/sections/user_guide/cli/drivers/orog_gsl/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/orog_gsl/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/sfc_climo_gen/help.rst b/docs/sections/user_guide/cli/drivers/sfc_climo_gen/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/sfc_climo_gen/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/sfc_climo_gen.rst b/docs/sections/user_guide/cli/drivers/sfc_climo_gen/index.rst similarity index 74% rename from docs/sections/user_guide/cli/drivers/sfc_climo_gen.rst rename to docs/sections/user_guide/cli/drivers/sfc_climo_gen/index.rst index fe8939667..4743dfa67 100644 --- a/docs/sections/user_guide/cli/drivers/sfc_climo_gen.rst +++ b/docs/sections/user_guide/cli/drivers/sfc_climo_gen/index.rst @@ -1,23 +1,11 @@ ``sfc_climo_gen`` ================= -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the :sfc-climo-gen:`sfc_climo_gen<>` component. -.. literalinclude:: sfc_climo_gen/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: sfc_climo_gen/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: sfc_climo_gen/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: sfc_climo_gen/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -59,10 +47,4 @@ Its contents are described in depth in section :ref:`sfc_climo_gen_yaml`. $ uw sfc_climo_gen provisioned_rundir --config-file config.yaml --batch -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: sfc_climo_gen/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: sfc_climo_gen/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/sfc_climo_gen/run-help.out b/docs/sections/user_guide/cli/drivers/sfc_climo_gen/run-help.out index 2e5f865ed..7b6b718ad 100644 --- a/docs/sections/user_guide/cli/drivers/sfc_climo_gen/run-help.out +++ b/docs/sections/user_guide/cli/drivers/sfc_climo_gen/run-help.out @@ -1,6 +1,7 @@ usage: uw sfc_climo_gen run [-h] [--version] [--config-file PATH] [--batch] [--dry-run] [--graph-file PATH] - [--key-path KEY[.KEY...]] [--quiet] [--verbose] + [--key-path KEY[.KEY...]] [--schema-file PATH] + [--quiet] [--verbose] A run @@ -20,6 +21,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/sfc_climo_gen/schema-options.rst b/docs/sections/user_guide/cli/drivers/sfc_climo_gen/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/sfc_climo_gen/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/shared/help.rst b/docs/sections/user_guide/cli/drivers/shared/help.rst new file mode 100644 index 000000000..640c6bbf8 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/shared/help.rst @@ -0,0 +1,13 @@ +.. literalinclude:: help.cmd + :language: text + :emphasize-lines: 1 +.. literalinclude:: help.out + :language: text + +All tasks take the same arguments. For example: + +.. literalinclude:: run-help.cmd + :language: text + :emphasize-lines: 1 +.. literalinclude:: run-help.out + :language: text diff --git a/docs/shared/idempotent.rst b/docs/sections/user_guide/cli/drivers/shared/idempotent.rst similarity index 100% rename from docs/shared/idempotent.rst rename to docs/sections/user_guide/cli/drivers/shared/idempotent.rst diff --git a/docs/sections/user_guide/cli/drivers/shared/schema-options.rst b/docs/sections/user_guide/cli/drivers/shared/schema-options.rst new file mode 100644 index 000000000..4d8705b97 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/shared/schema-options.rst @@ -0,0 +1,9 @@ +* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: + + .. literalinclude:: show-schema.cmd + :language: text + :emphasize-lines: 1 + .. literalinclude:: show-schema.out + :language: text + +* Use the ``--schema-file`` option to specify a custom :json-schema:`JSON Schema<>` file with which to validate the driver config. A custom schema could range in complexity from the simplest, most permissive schema, ``{}``, to one based on the internal schema shown by ``--show-schema``. diff --git a/docs/sections/user_guide/cli/drivers/shave/help.rst b/docs/sections/user_guide/cli/drivers/shave/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/shave/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/shave.rst b/docs/sections/user_guide/cli/drivers/shave/index.rst similarity index 69% rename from docs/sections/user_guide/cli/drivers/shave.rst rename to docs/sections/user_guide/cli/drivers/shave/index.rst index ff528c5ab..6035d18f9 100644 --- a/docs/sections/user_guide/cli/drivers/shave.rst +++ b/docs/sections/user_guide/cli/drivers/shave/index.rst @@ -1,23 +1,11 @@ ``shave`` ========= -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the UFS Utils preprocessing component ``shave``. Documentation for this UFS Utils component is :ufs-utils:`here `. -.. literalinclude:: shave/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: shave/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: shave/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: shave/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -53,10 +41,4 @@ Its contents are described in section :ref:`shave_yaml`. .. include:: /shared/key_path.rst -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: shave/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: shave/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/shave/run-help.out b/docs/sections/user_guide/cli/drivers/shave/run-help.out index 6f1148e6b..085279196 100644 --- a/docs/sections/user_guide/cli/drivers/shave/run-help.out +++ b/docs/sections/user_guide/cli/drivers/shave/run-help.out @@ -1,6 +1,6 @@ usage: uw shave run [-h] [--version] [--config-file PATH] [--batch] [--dry-run] [--graph-file PATH] [--key-path KEY[.KEY...]] - [--quiet] [--verbose] + [--schema-file PATH] [--quiet] [--verbose] A run @@ -20,6 +20,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/shave/schema-options.rst b/docs/sections/user_guide/cli/drivers/shave/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/shave/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/ungrib/help.rst b/docs/sections/user_guide/cli/drivers/ungrib/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/ungrib/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/ungrib.rst b/docs/sections/user_guide/cli/drivers/ungrib/index.rst similarity index 75% rename from docs/sections/user_guide/cli/drivers/ungrib.rst rename to docs/sections/user_guide/cli/drivers/ungrib/index.rst index df25b4e1f..6f8f4991c 100644 --- a/docs/sections/user_guide/cli/drivers/ungrib.rst +++ b/docs/sections/user_guide/cli/drivers/ungrib/index.rst @@ -1,23 +1,11 @@ ``ungrib`` ========== -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the WRF preprocessing component ``ungrib``. -.. literalinclude:: ungrib/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: ungrib/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: ungrib/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: ungrib/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -59,10 +47,4 @@ Its contents are described in depth in section :ref:`ungrib_yaml`. $ uw ungrib provisioned_rundir --config-file config.yaml --cycle 2021-04-01T12 --batch -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: ungrib/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: ungrib/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/ungrib/run-help.out b/docs/sections/user_guide/cli/drivers/ungrib/run-help.out index 6733f094b..d73f89464 100644 --- a/docs/sections/user_guide/cli/drivers/ungrib/run-help.out +++ b/docs/sections/user_guide/cli/drivers/ungrib/run-help.out @@ -1,6 +1,7 @@ usage: uw ungrib run --cycle CYCLE [-h] [--version] [--config-file PATH] [--batch] [--dry-run] [--graph-file PATH] - [--key-path KEY[.KEY...]] [--quiet] [--verbose] + [--key-path KEY[.KEY...]] [--schema-file PATH] [--quiet] + [--verbose] A run @@ -24,6 +25,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/ungrib/schema-options.rst b/docs/sections/user_guide/cli/drivers/ungrib/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/ungrib/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/upp/help.rst b/docs/sections/user_guide/cli/drivers/upp/help.rst new file mode 120000 index 000000000..fd986fe2c --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/upp/help.rst @@ -0,0 +1 @@ +../shared/help.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/drivers/upp.rst b/docs/sections/user_guide/cli/drivers/upp/index.rst similarity index 76% rename from docs/sections/user_guide/cli/drivers/upp.rst rename to docs/sections/user_guide/cli/drivers/upp/index.rst index ae8d24eb4..b1e2cef4d 100644 --- a/docs/sections/user_guide/cli/drivers/upp.rst +++ b/docs/sections/user_guide/cli/drivers/upp/index.rst @@ -1,23 +1,11 @@ ``upp`` ======= -.. include:: /shared/idempotent.rst +.. include:: ../shared/idempotent.rst The ``uw`` mode for configuring and running the `UPP `_ component. -.. literalinclude:: upp/help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: upp/help.out - :language: text - -All tasks take the same arguments. For example: - -.. literalinclude:: upp/run-help.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: upp/run-help.out - :language: text +.. include:: help.rst Examples ^^^^^^^^ @@ -59,10 +47,4 @@ Its contents are described in depth in section :ref:`upp_yaml`. $ uw upp provisioned_rundir --config-file config.yaml --cycle 2024-05-06T12 --leadtime 6 --batch -* Specifying the ``--show-schema`` flag, with no other options, prints the driver's schema: - -.. literalinclude:: upp/show-schema.cmd - :language: text - :emphasize-lines: 1 -.. literalinclude:: upp/show-schema.out - :language: text +.. include:: schema-options.rst diff --git a/docs/sections/user_guide/cli/drivers/upp/run-help.out b/docs/sections/user_guide/cli/drivers/upp/run-help.out index d727fd2ad..106254c93 100644 --- a/docs/sections/user_guide/cli/drivers/upp/run-help.out +++ b/docs/sections/user_guide/cli/drivers/upp/run-help.out @@ -1,7 +1,7 @@ usage: uw upp run --cycle CYCLE --leadtime LEADTIME [-h] [--version] [--config-file PATH] [--batch] [--dry-run] - [--graph-file PATH] [--key-path KEY[.KEY...]] [--quiet] - [--verbose] + [--graph-file PATH] [--key-path KEY[.KEY...]] + [--schema-file PATH] [--quiet] [--verbose] A run @@ -27,6 +27,8 @@ Optional arguments: --key-path KEY[.KEY...] Dot-separated path of keys leading through the config to the driver's configuration block + --schema-file PATH + Path to schema file to use for validation --quiet, -q Print no logging messages --verbose, -v diff --git a/docs/sections/user_guide/cli/drivers/upp/schema-options.rst b/docs/sections/user_guide/cli/drivers/upp/schema-options.rst new file mode 120000 index 000000000..0e3ca4a92 --- /dev/null +++ b/docs/sections/user_guide/cli/drivers/upp/schema-options.rst @@ -0,0 +1 @@ +../shared/schema-options.rst \ No newline at end of file diff --git a/docs/sections/user_guide/cli/tools/config/validate-fail.out b/docs/sections/user_guide/cli/tools/config/validate-fail.out index a581b8ce3..36086bd66 100644 --- a/docs/sections/user_guide/cli/tools/config/validate-fail.out +++ b/docs/sections/user_guide/cli/tools/config/validate-fail.out @@ -1,3 +1,3 @@ -[2024-05-23T19:39:17] ERROR 1 UW schema-validation error found -[2024-05-23T19:39:17] ERROR Error at values: -[2024-05-23T19:39:17] ERROR 'recipient' is a required property +[2024-08-26T22:54:28] ERROR 1 UW schema-validation error found in config +[2024-08-26T22:54:28] ERROR Error at values: +[2024-08-26T22:54:28] ERROR 'recipient' is a required property diff --git a/docs/sections/user_guide/cli/tools/config/validate-pass-stdin.out b/docs/sections/user_guide/cli/tools/config/validate-pass-stdin.out index a760389d0..8a5717ab3 100644 --- a/docs/sections/user_guide/cli/tools/config/validate-pass-stdin.out +++ b/docs/sections/user_guide/cli/tools/config/validate-pass-stdin.out @@ -1 +1 @@ -[2024-05-23T19:39:15] INFO 0 UW schema-validation errors found +[2024-08-26T22:54:27] INFO 0 UW schema-validation errors found in config diff --git a/docs/sections/user_guide/cli/tools/config/validate-pass.out b/docs/sections/user_guide/cli/tools/config/validate-pass.out index efd846fd7..b0b2e202e 100644 --- a/docs/sections/user_guide/cli/tools/config/validate-pass.out +++ b/docs/sections/user_guide/cli/tools/config/validate-pass.out @@ -1 +1 @@ -[2024-05-23T19:39:17] INFO 0 UW schema-validation errors found +[2024-08-26T22:54:28] INFO 0 UW schema-validation errors found in config diff --git a/docs/sections/user_guide/cli/tools/config/validate-verbose.out b/docs/sections/user_guide/cli/tools/config/validate-verbose.out index d1ed3d613..17dc2a651 100644 --- a/docs/sections/user_guide/cli/tools/config/validate-verbose.out +++ b/docs/sections/user_guide/cli/tools/config/validate-verbose.out @@ -1,20 +1,21 @@ -[2024-05-23T19:39:16] DEBUG Command: uw config validate --schema-file schema.jsonschema --input-file values.yaml --verbose -[2024-05-23T19:39:16] DEBUG Dereferencing, current value: -[2024-05-23T19:39:16] DEBUG values: -[2024-05-23T19:39:16] DEBUG greeting: Hello -[2024-05-23T19:39:16] DEBUG recipient: World -[2024-05-23T19:39:16] DEBUG [dereference] Rendering: Hello -[2024-05-23T19:39:17] DEBUG [dereference] Rendered: Hello -[2024-05-23T19:39:17] DEBUG [dereference] Rendering: greeting -[2024-05-23T19:39:17] DEBUG [dereference] Rendered: greeting -[2024-05-23T19:39:17] DEBUG [dereference] Rendering: World -[2024-05-23T19:39:17] DEBUG [dereference] Rendered: World -[2024-05-23T19:39:17] DEBUG [dereference] Rendering: recipient -[2024-05-23T19:39:17] DEBUG [dereference] Rendered: recipient -[2024-05-23T19:39:17] DEBUG [dereference] Rendering: values -[2024-05-23T19:39:17] DEBUG [dereference] Rendered: values -[2024-05-23T19:39:17] DEBUG Dereferencing, final value: -[2024-05-23T19:39:17] DEBUG values: -[2024-05-23T19:39:17] DEBUG greeting: Hello -[2024-05-23T19:39:17] DEBUG recipient: World -[2024-05-23T19:39:17] INFO 0 UW schema-validation errors found +[2024-08-26T22:54:28] DEBUG Command: uw config validate --schema-file schema.jsonschema --input-file values.yaml --verbose +[2024-08-26T22:54:28] DEBUG Using schema file: schema.jsonschema +[2024-08-26T22:54:28] DEBUG Dereferencing, current value: +[2024-08-26T22:54:28] DEBUG values: +[2024-08-26T22:54:28] DEBUG greeting: Hello +[2024-08-26T22:54:28] DEBUG recipient: World +[2024-08-26T22:54:28] DEBUG [dereference] Rendering: Hello +[2024-08-26T22:54:28] DEBUG [dereference] Rendered: Hello +[2024-08-26T22:54:28] DEBUG [dereference] Rendering: greeting +[2024-08-26T22:54:28] DEBUG [dereference] Rendered: greeting +[2024-08-26T22:54:28] DEBUG [dereference] Rendering: World +[2024-08-26T22:54:28] DEBUG [dereference] Rendered: World +[2024-08-26T22:54:28] DEBUG [dereference] Rendering: recipient +[2024-08-26T22:54:28] DEBUG [dereference] Rendered: recipient +[2024-08-26T22:54:28] DEBUG [dereference] Rendering: values +[2024-08-26T22:54:28] DEBUG [dereference] Rendered: values +[2024-08-26T22:54:28] DEBUG Dereferencing, final value: +[2024-08-26T22:54:28] DEBUG values: +[2024-08-26T22:54:28] DEBUG greeting: Hello +[2024-08-26T22:54:28] DEBUG recipient: World +[2024-08-26T22:54:29] INFO 0 UW schema-validation errors found in config diff --git a/docs/sections/user_guide/cli/tools/execute.rst b/docs/sections/user_guide/cli/tools/execute.rst index d5d6ee945..753b7cb3f 100644 --- a/docs/sections/user_guide/cli/tools/execute.rst +++ b/docs/sections/user_guide/cli/tools/execute.rst @@ -61,4 +61,4 @@ Config ``rand.yaml`` .. literalinclude:: execute/alt-schema.out :language: text -* Other arguments behave identically to the same-named arguments to built-in ``uwtools`` drivers (see :ref:`drivers`). +* Other arguments behave identically to the same-named arguments to internal ``uwtools`` drivers (see :ref:`drivers`). diff --git a/docs/sections/user_guide/cli/tools/execute/alt-schema.out b/docs/sections/user_guide/cli/tools/execute/alt-schema.out index 9691a3987..c89f32d66 100644 --- a/docs/sections/user_guide/cli/tools/execute/alt-schema.out +++ b/docs/sections/user_guide/cli/tools/execute/alt-schema.out @@ -1,7 +1,7 @@ -[2024-08-08T23:46:07] INFO 0 UW schema-validation errors found -[2024-08-08T23:46:07] INFO rand Random-integer file: Initial state: Not Ready -[2024-08-08T23:46:07] INFO rand Random-integer file: Checking requirements -[2024-08-08T23:46:07] INFO rand Random-integer file: Requirement(s) ready -[2024-08-08T23:46:07] INFO rand Random-integer file: Executing -[2024-08-08T23:46:07] INFO rand Random-integer file: Final state: Ready -Random integer is 38 +[2024-08-26T23:03:41] INFO 0 UW schema-validation errors found in rand config +[2024-08-26T23:03:41] INFO rand Random-integer file: Initial state: Not Ready +[2024-08-26T23:03:41] INFO rand Random-integer file: Checking requirements +[2024-08-26T23:03:41] INFO rand Random-integer file: Requirement(s) ready +[2024-08-26T23:03:41] INFO rand Random-integer file: Executing +[2024-08-26T23:03:41] INFO rand Random-integer file: Final state: Ready +Random integer is 14 diff --git a/docs/sections/user_guide/cli/tools/execute/execute.out b/docs/sections/user_guide/cli/tools/execute/execute.out index 3c291fc99..0851d0480 100644 --- a/docs/sections/user_guide/cli/tools/execute/execute.out +++ b/docs/sections/user_guide/cli/tools/execute/execute.out @@ -1,7 +1,7 @@ -[2024-08-08T23:46:07] INFO 0 UW schema-validation errors found -[2024-08-08T23:46:07] INFO rand Random-integer file: Initial state: Not Ready -[2024-08-08T23:46:07] INFO rand Random-integer file: Checking requirements -[2024-08-08T23:46:07] INFO rand Random-integer file: Requirement(s) ready -[2024-08-08T23:46:07] INFO rand Random-integer file: Executing -[2024-08-08T23:46:07] INFO rand Random-integer file: Final state: Ready -Random integer is 43 +[2024-08-26T23:03:40] INFO 0 UW schema-validation errors found in rand config +[2024-08-26T23:03:40] INFO rand Random-integer file: Initial state: Not Ready +[2024-08-26T23:03:40] INFO rand Random-integer file: Checking requirements +[2024-08-26T23:03:40] INFO rand Random-integer file: Requirement(s) ready +[2024-08-26T23:03:40] INFO rand Random-integer file: Executing +[2024-08-26T23:03:40] INFO rand Random-integer file: Final state: Ready +Random integer is 80 diff --git a/docs/sections/user_guide/cli/tools/fs/copy-exec-no-target-dir-err.out b/docs/sections/user_guide/cli/tools/fs/copy-exec-no-target-dir-err.out index 02c57878d..71b4ca3a1 100644 --- a/docs/sections/user_guide/cli/tools/fs/copy-exec-no-target-dir-err.out +++ b/docs/sections/user_guide/cli/tools/fs/copy-exec-no-target-dir-err.out @@ -1,3 +1,3 @@ -[2024-08-14T15:19:59] INFO Validating config against internal schema: files-to-stage -[2024-08-14T15:19:59] INFO 0 UW schema-validation errors found -[2024-08-14T15:19:59] ERROR Relative path 'foo' requires the target directory to be specified +[2024-08-26T23:03:40] INFO Validating config against internal schema: files-to-stage +[2024-08-26T23:03:40] INFO 0 UW schema-validation errors found in fs config +[2024-08-26T23:03:40] ERROR Relative path 'foo' requires the target directory to be specified diff --git a/docs/sections/user_guide/cli/tools/fs/copy-exec-timedep.out b/docs/sections/user_guide/cli/tools/fs/copy-exec-timedep.out index 30b4605fa..48bee1999 100644 --- a/docs/sections/user_guide/cli/tools/fs/copy-exec-timedep.out +++ b/docs/sections/user_guide/cli/tools/fs/copy-exec-timedep.out @@ -1,13 +1,13 @@ -[2024-08-02T00:43:08] INFO Validating config against internal schema: files-to-stage -[2024-08-02T00:43:08] INFO 0 UW schema-validation errors found -[2024-08-02T00:43:08] INFO File copies: Initial state: Not Ready -[2024-08-02T00:43:08] INFO File copies: Checking requirements -[2024-08-02T00:43:08] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Initial state: Not Ready -[2024-08-02T00:43:08] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Checking requirements -[2024-08-02T00:43:08] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Requirement(s) ready -[2024-08-02T00:43:08] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Executing -[2024-08-02T00:43:08] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Final state: Ready -[2024-08-02T00:43:08] INFO File copies: Final state: Ready +[2024-08-26T23:03:42] INFO Validating config against internal schema: files-to-stage +[2024-08-26T23:03:43] INFO 0 UW schema-validation errors found in fs config +[2024-08-26T23:03:43] INFO File copies: Initial state: Not Ready +[2024-08-26T23:03:43] INFO File copies: Checking requirements +[2024-08-26T23:03:43] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Initial state: Not Ready +[2024-08-26T23:03:43] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Checking requirements +[2024-08-26T23:03:43] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Requirement(s) ready +[2024-08-26T23:03:43] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Executing +[2024-08-26T23:03:43] INFO Copy src/20240529/12/006/baz -> copy-dst-timedep/baz-2024-05-29T18: Final state: Ready +[2024-08-26T23:03:43] INFO File copies: Final state: Ready copy-dst-timedep └── baz-2024-05-29T18 diff --git a/docs/sections/user_guide/cli/tools/fs/copy-exec.out b/docs/sections/user_guide/cli/tools/fs/copy-exec.out index 7c5b50333..57221e756 100644 --- a/docs/sections/user_guide/cli/tools/fs/copy-exec.out +++ b/docs/sections/user_guide/cli/tools/fs/copy-exec.out @@ -1,18 +1,18 @@ -[2024-08-02T00:43:08] INFO Validating config against internal schema: files-to-stage -[2024-08-02T00:43:08] INFO 0 UW schema-validation errors found -[2024-08-02T00:43:08] INFO File copies: Initial state: Not Ready -[2024-08-02T00:43:08] INFO File copies: Checking requirements -[2024-08-02T00:43:08] INFO Copy src/foo -> copy-dst/foo: Initial state: Not Ready -[2024-08-02T00:43:08] INFO Copy src/foo -> copy-dst/foo: Checking requirements -[2024-08-02T00:43:08] INFO Copy src/foo -> copy-dst/foo: Requirement(s) ready -[2024-08-02T00:43:08] INFO Copy src/foo -> copy-dst/foo: Executing -[2024-08-02T00:43:08] INFO Copy src/foo -> copy-dst/foo: Final state: Ready -[2024-08-02T00:43:08] INFO Copy src/bar -> copy-dst/subdir/bar: Initial state: Not Ready -[2024-08-02T00:43:08] INFO Copy src/bar -> copy-dst/subdir/bar: Checking requirements -[2024-08-02T00:43:08] INFO Copy src/bar -> copy-dst/subdir/bar: Requirement(s) ready -[2024-08-02T00:43:08] INFO Copy src/bar -> copy-dst/subdir/bar: Executing -[2024-08-02T00:43:08] INFO Copy src/bar -> copy-dst/subdir/bar: Final state: Ready -[2024-08-02T00:43:08] INFO File copies: Final state: Ready +[2024-08-26T23:03:41] INFO Validating config against internal schema: files-to-stage +[2024-08-26T23:03:41] INFO 0 UW schema-validation errors found in fs config +[2024-08-26T23:03:41] INFO File copies: Initial state: Not Ready +[2024-08-26T23:03:41] INFO File copies: Checking requirements +[2024-08-26T23:03:41] INFO Copy src/foo -> copy-dst/foo: Initial state: Not Ready +[2024-08-26T23:03:41] INFO Copy src/foo -> copy-dst/foo: Checking requirements +[2024-08-26T23:03:41] INFO Copy src/foo -> copy-dst/foo: Requirement(s) ready +[2024-08-26T23:03:41] INFO Copy src/foo -> copy-dst/foo: Executing +[2024-08-26T23:03:41] INFO Copy src/foo -> copy-dst/foo: Final state: Ready +[2024-08-26T23:03:41] INFO Copy src/bar -> copy-dst/subdir/bar: Initial state: Not Ready +[2024-08-26T23:03:41] INFO Copy src/bar -> copy-dst/subdir/bar: Checking requirements +[2024-08-26T23:03:41] INFO Copy src/bar -> copy-dst/subdir/bar: Requirement(s) ready +[2024-08-26T23:03:41] INFO Copy src/bar -> copy-dst/subdir/bar: Executing +[2024-08-26T23:03:41] INFO Copy src/bar -> copy-dst/subdir/bar: Final state: Ready +[2024-08-26T23:03:41] INFO File copies: Final state: Ready copy-dst ├── foo diff --git a/docs/sections/user_guide/cli/tools/fs/link-exec-no-target-dir-err.out b/docs/sections/user_guide/cli/tools/fs/link-exec-no-target-dir-err.out index 03c1247f5..dcb5593ed 100644 --- a/docs/sections/user_guide/cli/tools/fs/link-exec-no-target-dir-err.out +++ b/docs/sections/user_guide/cli/tools/fs/link-exec-no-target-dir-err.out @@ -1,3 +1,3 @@ -[2024-08-14T15:19:57] INFO Validating config against internal schema: files-to-stage -[2024-08-14T15:19:57] INFO 0 UW schema-validation errors found -[2024-08-14T15:19:57] ERROR Relative path 'foo' requires the target directory to be specified +[2024-08-26T23:03:41] INFO Validating config against internal schema: files-to-stage +[2024-08-26T23:03:41] INFO 0 UW schema-validation errors found in fs config +[2024-08-26T23:03:41] ERROR Relative path 'foo' requires the target directory to be specified diff --git a/docs/sections/user_guide/cli/tools/fs/link-exec-timedep.out b/docs/sections/user_guide/cli/tools/fs/link-exec-timedep.out index 6256a41df..c97fb1879 100644 --- a/docs/sections/user_guide/cli/tools/fs/link-exec-timedep.out +++ b/docs/sections/user_guide/cli/tools/fs/link-exec-timedep.out @@ -1,13 +1,13 @@ -[2024-08-02T00:43:09] INFO Validating config against internal schema: files-to-stage -[2024-08-02T00:43:09] INFO 0 UW schema-validation errors found -[2024-08-02T00:43:09] INFO File links: Initial state: Not Ready -[2024-08-02T00:43:09] INFO File links: Checking requirements -[2024-08-02T00:43:09] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Initial state: Not Ready -[2024-08-02T00:43:09] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Checking requirements -[2024-08-02T00:43:09] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Requirement(s) ready -[2024-08-02T00:43:09] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Executing -[2024-08-02T00:43:09] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Final state: Ready -[2024-08-02T00:43:09] INFO File links: Final state: Ready +[2024-08-26T23:03:41] INFO Validating config against internal schema: files-to-stage +[2024-08-26T23:03:41] INFO 0 UW schema-validation errors found in fs config +[2024-08-26T23:03:41] INFO File links: Initial state: Not Ready +[2024-08-26T23:03:41] INFO File links: Checking requirements +[2024-08-26T23:03:41] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Initial state: Not Ready +[2024-08-26T23:03:41] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Checking requirements +[2024-08-26T23:03:41] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Requirement(s) ready +[2024-08-26T23:03:41] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Executing +[2024-08-26T23:03:42] INFO Link link-dst-timedep/baz-2024-05-29T18 -> src/20240529/12/006/baz: Final state: Ready +[2024-08-26T23:03:42] INFO File links: Final state: Ready link-dst-timedep └── baz-2024-05-29T18 -> ../src/20240529/12/006/baz diff --git a/docs/sections/user_guide/cli/tools/fs/link-exec.out b/docs/sections/user_guide/cli/tools/fs/link-exec.out index 2247f979c..ee1524967 100644 --- a/docs/sections/user_guide/cli/tools/fs/link-exec.out +++ b/docs/sections/user_guide/cli/tools/fs/link-exec.out @@ -1,18 +1,18 @@ -[2024-08-02T00:43:08] INFO Validating config against internal schema: files-to-stage -[2024-08-02T00:43:08] INFO 0 UW schema-validation errors found -[2024-08-02T00:43:08] INFO File links: Initial state: Not Ready -[2024-08-02T00:43:08] INFO File links: Checking requirements -[2024-08-02T00:43:08] INFO Link link-dst/foo -> src/foo: Initial state: Not Ready -[2024-08-02T00:43:08] INFO Link link-dst/foo -> src/foo: Checking requirements -[2024-08-02T00:43:08] INFO Link link-dst/foo -> src/foo: Requirement(s) ready -[2024-08-02T00:43:08] INFO Link link-dst/foo -> src/foo: Executing -[2024-08-02T00:43:08] INFO Link link-dst/foo -> src/foo: Final state: Ready -[2024-08-02T00:43:08] INFO Link link-dst/subdir/bar -> src/bar: Initial state: Not Ready -[2024-08-02T00:43:08] INFO Link link-dst/subdir/bar -> src/bar: Checking requirements -[2024-08-02T00:43:08] INFO Link link-dst/subdir/bar -> src/bar: Requirement(s) ready -[2024-08-02T00:43:08] INFO Link link-dst/subdir/bar -> src/bar: Executing -[2024-08-02T00:43:08] INFO Link link-dst/subdir/bar -> src/bar: Final state: Ready -[2024-08-02T00:43:08] INFO File links: Final state: Ready +[2024-08-26T23:03:42] INFO Validating config against internal schema: files-to-stage +[2024-08-26T23:03:43] INFO 0 UW schema-validation errors found in fs config +[2024-08-26T23:03:43] INFO File links: Initial state: Not Ready +[2024-08-26T23:03:43] INFO File links: Checking requirements +[2024-08-26T23:03:43] INFO Link link-dst/foo -> src/foo: Initial state: Not Ready +[2024-08-26T23:03:43] INFO Link link-dst/foo -> src/foo: Checking requirements +[2024-08-26T23:03:43] INFO Link link-dst/foo -> src/foo: Requirement(s) ready +[2024-08-26T23:03:43] INFO Link link-dst/foo -> src/foo: Executing +[2024-08-26T23:03:43] INFO Link link-dst/foo -> src/foo: Final state: Ready +[2024-08-26T23:03:43] INFO Link link-dst/subdir/bar -> src/bar: Initial state: Not Ready +[2024-08-26T23:03:43] INFO Link link-dst/subdir/bar -> src/bar: Checking requirements +[2024-08-26T23:03:43] INFO Link link-dst/subdir/bar -> src/bar: Requirement(s) ready +[2024-08-26T23:03:43] INFO Link link-dst/subdir/bar -> src/bar: Executing +[2024-08-26T23:03:43] INFO Link link-dst/subdir/bar -> src/bar: Final state: Ready +[2024-08-26T23:03:43] INFO File links: Final state: Ready link-dst ├── foo -> ../src/foo diff --git a/docs/sections/user_guide/cli/tools/fs/makedirs-exec-no-target-dir-err.out b/docs/sections/user_guide/cli/tools/fs/makedirs-exec-no-target-dir-err.out index ceefc693e..84c7710bf 100644 --- a/docs/sections/user_guide/cli/tools/fs/makedirs-exec-no-target-dir-err.out +++ b/docs/sections/user_guide/cli/tools/fs/makedirs-exec-no-target-dir-err.out @@ -1,3 +1,3 @@ -[2024-08-14T15:19:58] INFO Validating config against internal schema: makedirs -[2024-08-14T15:19:58] INFO 0 UW schema-validation errors found -[2024-08-14T15:19:58] ERROR Relative path 'foo' requires the target directory to be specified +[2024-08-26T23:03:44] INFO Validating config against internal schema: makedirs +[2024-08-26T23:03:45] INFO 0 UW schema-validation errors found in fs config +[2024-08-26T23:03:45] ERROR Relative path 'foo' requires the target directory to be specified diff --git a/docs/sections/user_guide/cli/tools/fs/makedirs-exec-timedep.out b/docs/sections/user_guide/cli/tools/fs/makedirs-exec-timedep.out index a89e33a29..68199d440 100644 --- a/docs/sections/user_guide/cli/tools/fs/makedirs-exec-timedep.out +++ b/docs/sections/user_guide/cli/tools/fs/makedirs-exec-timedep.out @@ -1,18 +1,18 @@ -[2024-08-12T04:35:49] INFO Validating config against internal schema: makedirs -[2024-08-12T04:35:49] INFO 0 UW schema-validation errors found -[2024-08-12T04:35:49] INFO Directories: Initial state: Not Ready -[2024-08-12T04:35:49] INFO Directories: Checking requirements -[2024-08-12T04:35:49] INFO Directory makedirs-parent-timedep/foo/20240529/12/006/bar: Initial state: Not Ready -[2024-08-12T04:35:49] INFO Directory makedirs-parent-timedep/foo/20240529/12/006/bar: Checking requirements -[2024-08-12T04:35:49] INFO Directory makedirs-parent-timedep/foo/20240529/12/006/bar: Requirement(s) ready -[2024-08-12T04:35:49] INFO Directory makedirs-parent-timedep/foo/20240529/12/006/bar: Executing -[2024-08-12T04:35:49] INFO Directory makedirs-parent-timedep/foo/20240529/12/006/bar: Final state: Ready -[2024-08-12T04:35:49] INFO Directory makedirs-parent-timedep/baz/20240529/12/006/qux: Initial state: Not Ready -[2024-08-12T04:35:49] INFO Directory makedirs-parent-timedep/baz/20240529/12/006/qux: Checking requirements -[2024-08-12T04:35:49] INFO Directory makedirs-parent-timedep/baz/20240529/12/006/qux: Requirement(s) ready -[2024-08-12T04:35:49] INFO Directory makedirs-parent-timedep/baz/20240529/12/006/qux: Executing -[2024-08-12T04:35:49] INFO Directory makedirs-parent-timedep/baz/20240529/12/006/qux: Final state: Ready -[2024-08-12T04:35:49] INFO Directories: Final state: Ready +[2024-08-26T23:03:46] INFO Validating config against internal schema: makedirs +[2024-08-26T23:03:46] INFO 0 UW schema-validation errors found in fs config +[2024-08-26T23:03:46] INFO Directories: Initial state: Not Ready +[2024-08-26T23:03:46] INFO Directories: Checking requirements +[2024-08-26T23:03:46] INFO Directory makedirs-parent-timedep/foo/20240529/12/006/bar: Initial state: Not Ready +[2024-08-26T23:03:46] INFO Directory makedirs-parent-timedep/foo/20240529/12/006/bar: Checking requirements +[2024-08-26T23:03:46] INFO Directory makedirs-parent-timedep/foo/20240529/12/006/bar: Requirement(s) ready +[2024-08-26T23:03:46] INFO Directory makedirs-parent-timedep/foo/20240529/12/006/bar: Executing +[2024-08-26T23:03:46] INFO Directory makedirs-parent-timedep/foo/20240529/12/006/bar: Final state: Ready +[2024-08-26T23:03:46] INFO Directory makedirs-parent-timedep/baz/20240529/12/006/qux: Initial state: Not Ready +[2024-08-26T23:03:46] INFO Directory makedirs-parent-timedep/baz/20240529/12/006/qux: Checking requirements +[2024-08-26T23:03:46] INFO Directory makedirs-parent-timedep/baz/20240529/12/006/qux: Requirement(s) ready +[2024-08-26T23:03:46] INFO Directory makedirs-parent-timedep/baz/20240529/12/006/qux: Executing +[2024-08-26T23:03:46] INFO Directory makedirs-parent-timedep/baz/20240529/12/006/qux: Final state: Ready +[2024-08-26T23:03:46] INFO Directories: Final state: Ready makedirs-parent-timedep/ ├── baz/ diff --git a/docs/sections/user_guide/cli/tools/fs/makedirs-exec.out b/docs/sections/user_guide/cli/tools/fs/makedirs-exec.out index 376518b59..92e5ae4fb 100644 --- a/docs/sections/user_guide/cli/tools/fs/makedirs-exec.out +++ b/docs/sections/user_guide/cli/tools/fs/makedirs-exec.out @@ -1,18 +1,18 @@ -[2024-08-12T04:35:49] INFO Validating config against internal schema: makedirs -[2024-08-12T04:35:49] INFO 0 UW schema-validation errors found -[2024-08-12T04:35:49] INFO Directories: Initial state: Not Ready -[2024-08-12T04:35:49] INFO Directories: Checking requirements -[2024-08-12T04:35:49] INFO Directory makedirs-parent/foo: Initial state: Not Ready -[2024-08-12T04:35:49] INFO Directory makedirs-parent/foo: Checking requirements -[2024-08-12T04:35:49] INFO Directory makedirs-parent/foo: Requirement(s) ready -[2024-08-12T04:35:49] INFO Directory makedirs-parent/foo: Executing -[2024-08-12T04:35:49] INFO Directory makedirs-parent/foo: Final state: Ready -[2024-08-12T04:35:49] INFO Directory makedirs-parent/bar: Initial state: Not Ready -[2024-08-12T04:35:49] INFO Directory makedirs-parent/bar: Checking requirements -[2024-08-12T04:35:49] INFO Directory makedirs-parent/bar: Requirement(s) ready -[2024-08-12T04:35:49] INFO Directory makedirs-parent/bar: Executing -[2024-08-12T04:35:49] INFO Directory makedirs-parent/bar: Final state: Ready -[2024-08-12T04:35:49] INFO Directories: Final state: Ready +[2024-08-26T23:03:46] INFO Validating config against internal schema: makedirs +[2024-08-26T23:03:46] INFO 0 UW schema-validation errors found in fs config +[2024-08-26T23:03:46] INFO Directories: Initial state: Not Ready +[2024-08-26T23:03:46] INFO Directories: Checking requirements +[2024-08-26T23:03:46] INFO Directory makedirs-parent/foo: Initial state: Not Ready +[2024-08-26T23:03:46] INFO Directory makedirs-parent/foo: Checking requirements +[2024-08-26T23:03:46] INFO Directory makedirs-parent/foo: Requirement(s) ready +[2024-08-26T23:03:46] INFO Directory makedirs-parent/foo: Executing +[2024-08-26T23:03:46] INFO Directory makedirs-parent/foo: Final state: Ready +[2024-08-26T23:03:46] INFO Directory makedirs-parent/bar: Initial state: Not Ready +[2024-08-26T23:03:46] INFO Directory makedirs-parent/bar: Checking requirements +[2024-08-26T23:03:46] INFO Directory makedirs-parent/bar: Requirement(s) ready +[2024-08-26T23:03:46] INFO Directory makedirs-parent/bar: Executing +[2024-08-26T23:03:46] INFO Directory makedirs-parent/bar: Final state: Ready +[2024-08-26T23:03:46] INFO Directories: Final state: Ready makedirs-parent/ ├── bar/ diff --git a/docs/sections/user_guide/cli/tools/rocoto/realize-exec-file.out b/docs/sections/user_guide/cli/tools/rocoto/realize-exec-file.out index 894f75605..86924fddc 100644 --- a/docs/sections/user_guide/cli/tools/rocoto/realize-exec-file.out +++ b/docs/sections/user_guide/cli/tools/rocoto/realize-exec-file.out @@ -1,5 +1,5 @@ -[2024-08-02T00:43:07] INFO 0 UW schema-validation errors found -[2024-08-02T00:43:07] INFO 0 Rocoto validation errors found +[2024-08-26T23:11:41] INFO 0 UW schema-validation errors found in Rocoto config +[2024-08-26T23:11:41] INFO 0 Rocoto XML validation errors found diff --git a/docs/sections/user_guide/cli/tools/rocoto/realize-exec-stdout-verbose.out b/docs/sections/user_guide/cli/tools/rocoto/realize-exec-stdout-verbose.out index 2a055c04a..70aad1c6e 100644 --- a/docs/sections/user_guide/cli/tools/rocoto/realize-exec-stdout-verbose.out +++ b/docs/sections/user_guide/cli/tools/rocoto/realize-exec-stdout-verbose.out @@ -1,21 +1,21 @@ -[2024-08-02T00:43:09] DEBUG Command: uw rocoto realize --config-file rocoto.yaml --verbose -[2024-08-02T00:43:09] DEBUG Dereferencing, current value: -[2024-08-02T00:43:09] DEBUG workflow: -[2024-08-02T00:43:09] DEBUG attrs: -[2024-08-02T00:43:09] DEBUG realtime: false -[2024-08-02T00:43:09] DEBUG scheduler: slurm -[2024-08-02T00:43:09] DEBUG cycledef: -[2024-08-02T00:43:09] DEBUG - attrs: -[2024-08-02T00:43:09] DEBUG group: howdy -[2024-08-02T00:43:09] DEBUG spec: 202209290000 202209300000 06:00:00 +[2024-08-26T23:39:19] DEBUG Command: uw rocoto realize --config-file rocoto.yaml --verbose +[2024-08-26T23:39:19] DEBUG Dereferencing, current value: +[2024-08-26T23:39:19] DEBUG workflow: +[2024-08-26T23:39:19] DEBUG attrs: +[2024-08-26T23:39:19] DEBUG realtime: false +[2024-08-26T23:39:19] DEBUG scheduler: slurm +[2024-08-26T23:39:19] DEBUG cycledef: +[2024-08-26T23:39:19] DEBUG - attrs: +[2024-08-26T23:39:19] DEBUG group: howdy +[2024-08-26T23:39:19] DEBUG spec: 202209290000 202209300000 06:00:00 ... -[2024-08-02T00:43:09] DEBUG cycledefs: howdy -[2024-08-02T00:43:09] DEBUG account: '&ACCOUNT;' -[2024-08-02T00:43:09] DEBUG command: echo hello $person -[2024-08-02T00:43:09] DEBUG jobname: hello -[2024-08-02T00:43:09] DEBUG native: --reservation my_reservation -[2024-08-02T00:43:09] DEBUG nodes: 1:ppn=1 -[2024-08-02T00:43:09] DEBUG walltime: 00:01:00 -[2024-08-02T00:43:09] DEBUG envars: -[2024-08-02T00:43:09] DEBUG person: siri -[2024-08-02T00:43:09] INFO 0 Rocoto validation errors found +[2024-08-26T23:39:20] DEBUG cycledefs: howdy +[2024-08-26T23:39:20] DEBUG account: '&ACCOUNT;' +[2024-08-26T23:39:20] DEBUG command: echo hello $person +[2024-08-26T23:39:20] DEBUG jobname: hello +[2024-08-26T23:39:20] DEBUG native: --reservation my_reservation +[2024-08-26T23:39:20] DEBUG nodes: 1:ppn=1 +[2024-08-26T23:39:20] DEBUG walltime: 00:01:00 +[2024-08-26T23:39:20] DEBUG envars: +[2024-08-26T23:39:20] DEBUG person: siri +[2024-08-26T23:39:20] INFO 0 Rocoto XML validation errors found diff --git a/docs/sections/user_guide/cli/tools/rocoto/realize-exec-stdout.out b/docs/sections/user_guide/cli/tools/rocoto/realize-exec-stdout.out index 865b4367d..7f2d1a1e1 100644 --- a/docs/sections/user_guide/cli/tools/rocoto/realize-exec-stdout.out +++ b/docs/sections/user_guide/cli/tools/rocoto/realize-exec-stdout.out @@ -1,5 +1,5 @@ -[2024-08-02T00:43:08] INFO 0 UW schema-validation errors found -[2024-08-02T00:43:08] INFO 0 Rocoto validation errors found +[2024-08-26T23:11:42] INFO 0 UW schema-validation errors found in Rocoto config +[2024-08-26T23:11:42] INFO 0 Rocoto XML validation errors found diff --git a/docs/sections/user_guide/cli/tools/rocoto/validate-bad-file.out b/docs/sections/user_guide/cli/tools/rocoto/validate-bad-file.out index 30cf8fe43..fd68379ad 100644 --- a/docs/sections/user_guide/cli/tools/rocoto/validate-bad-file.out +++ b/docs/sections/user_guide/cli/tools/rocoto/validate-bad-file.out @@ -1,24 +1,24 @@ -[2024-05-23T19:39:16] ERROR 3 Rocoto validation errors found -[2024-05-23T19:39:16] ERROR :9:0:ERROR:RELAXNGV:RELAXNG_ERR_NOELEM: Expecting an element command, got nothing -[2024-05-23T19:39:16] ERROR :9:0:ERROR:RELAXNGV:RELAXNG_ERR_INTERSEQ: Invalid sequence in interleave -[2024-05-23T19:39:16] ERROR :9:0:ERROR:RELAXNGV:RELAXNG_ERR_CONTENTVALID: Element task failed to validate content -[2024-05-23T19:39:16] ERROR Invalid Rocoto XML: -[2024-05-23T19:39:16] ERROR 1 -[2024-05-23T19:39:16] ERROR 2 -[2024-05-23T19:39:16] ERROR 4 -[2024-05-23T19:39:16] ERROR 5 ]> -[2024-05-23T19:39:16] ERROR 6 -[2024-05-23T19:39:16] ERROR 7 202209290000 202209300000 06:00:00 -[2024-05-23T19:39:16] ERROR 8 /some/path/to/&FOO; -[2024-05-23T19:39:16] ERROR 9 -[2024-05-23T19:39:16] ERROR 10 &ACCOUNT; -[2024-05-23T19:39:16] ERROR 11 1:ppn=1 -[2024-05-23T19:39:16] ERROR 12 00:01:00 -[2024-05-23T19:39:16] ERROR 13 hello -[2024-05-23T19:39:16] ERROR 14 -[2024-05-23T19:39:16] ERROR 15 person -[2024-05-23T19:39:16] ERROR 16 siri -[2024-05-23T19:39:16] ERROR 17 -[2024-05-23T19:39:16] ERROR 18 -[2024-05-23T19:39:16] ERROR 19 +[2024-08-26T23:11:41] ERROR 3 Rocoto XML validation errors found +[2024-08-26T23:11:41] ERROR :9:0:ERROR:RELAXNGV:RELAXNG_ERR_NOELEM: Expecting an element command, got nothing +[2024-08-26T23:11:41] ERROR :9:0:ERROR:RELAXNGV:RELAXNG_ERR_INTERSEQ: Invalid sequence in interleave +[2024-08-26T23:11:41] ERROR :9:0:ERROR:RELAXNGV:RELAXNG_ERR_CONTENTVALID: Element task failed to validate content +[2024-08-26T23:11:41] ERROR Invalid Rocoto XML: +[2024-08-26T23:11:41] ERROR 1 +[2024-08-26T23:11:41] ERROR 2 +[2024-08-26T23:11:41] ERROR 4 +[2024-08-26T23:11:41] ERROR 5 ]> +[2024-08-26T23:11:41] ERROR 6 +[2024-08-26T23:11:41] ERROR 7 202209290000 202209300000 06:00:00 +[2024-08-26T23:11:41] ERROR 8 /some/path/to/&FOO; +[2024-08-26T23:11:41] ERROR 9 +[2024-08-26T23:11:41] ERROR 10 &ACCOUNT; +[2024-08-26T23:11:41] ERROR 11 1:ppn=1 +[2024-08-26T23:11:41] ERROR 12 00:01:00 +[2024-08-26T23:11:41] ERROR 13 hello +[2024-08-26T23:11:41] ERROR 14 +[2024-08-26T23:11:41] ERROR 15 person +[2024-08-26T23:11:41] ERROR 16 siri +[2024-08-26T23:11:41] ERROR 17 +[2024-08-26T23:11:41] ERROR 18 +[2024-08-26T23:11:41] ERROR 19 diff --git a/docs/sections/user_guide/cli/tools/rocoto/validate-good-file.out b/docs/sections/user_guide/cli/tools/rocoto/validate-good-file.out index 75a232457..2c54c1c86 100644 --- a/docs/sections/user_guide/cli/tools/rocoto/validate-good-file.out +++ b/docs/sections/user_guide/cli/tools/rocoto/validate-good-file.out @@ -1 +1 @@ -[2024-05-23T19:39:16] INFO 0 Rocoto validation errors found +[2024-08-26T23:11:42] INFO 0 Rocoto XML validation errors found diff --git a/docs/sections/user_guide/cli/tools/rocoto/validate-good-stdin.out b/docs/sections/user_guide/cli/tools/rocoto/validate-good-stdin.out index 75a232457..2c54c1c86 100644 --- a/docs/sections/user_guide/cli/tools/rocoto/validate-good-stdin.out +++ b/docs/sections/user_guide/cli/tools/rocoto/validate-good-stdin.out @@ -1 +1 @@ -[2024-05-23T19:39:16] INFO 0 Rocoto validation errors found +[2024-08-26T23:11:42] INFO 0 Rocoto XML validation errors found diff --git a/src/uwtools/api/config.py b/src/uwtools/api/config.py index ec05a0fa5..bbdd7c517 100644 --- a/src/uwtools/api/config.py +++ b/src/uwtools/api/config.py @@ -179,6 +179,7 @@ def validate( try: _validate_external( schema_file=_str2path(schema_file), + desc="config", config=_ensure_data_source(_str2path(config), stdin_ok), ) except UWConfigError: diff --git a/src/uwtools/api/execute.py b/src/uwtools/api/execute.py index 24c16cee6..6ab629db0 100644 --- a/src/uwtools/api/execute.py +++ b/src/uwtools/api/execute.py @@ -41,7 +41,7 @@ def execute( :param module: Path to driver module or name of module on sys.path. :param classname: Name of driver class to instantiate. :param task: Name of driver task to execute. - :param schema_file: Path to schema file. + :param schema_file: The JSON Schema file to use for validation. :param config: Path to config file (read stdin if missing or None). :param cycle: The cycle. :param leadtime: The leadtime. diff --git a/src/uwtools/cli.py b/src/uwtools/cli.py index c0d0a5a13..748137b62 100644 --- a/src/uwtools/cli.py +++ b/src/uwtools/cli.py @@ -1032,6 +1032,7 @@ def _add_subparser_for_driver_task( helpmsg="Dot-separated path of keys leading through the config " "to the driver's configuration block", ) + _add_arg_schema_file(optional) checks = _add_args_verbosity(optional) return checks @@ -1129,6 +1130,7 @@ def _dispatch_to_driver(name: str, args: Args) -> bool: "dry_run": args[STR.dryrun], "graph_file": args[STR.graphfile], "key_path": args[STR.keypath], + "schema_file": args[STR.schemafile], "stdin_ok": True, } for k in [STR.batch, STR.cycle, STR.leadtime]: diff --git a/src/uwtools/config/validator.py b/src/uwtools/config/validator.py index 42b723ed6..8eccec18a 100644 --- a/src/uwtools/config/validator.py +++ b/src/uwtools/config/validator.py @@ -20,48 +20,56 @@ # Public functions -def bundle(schema: dict) -> dict: +def bundle(schema: dict, keys: Optional[list] = None) -> dict: """ Bundle a schema by dereferencing links to other schemas. :param schema: A JSON Schema. + :param keys: Keys leading up to this block. Internal use only, do not manually specify. :returns: The bundled schema. """ - key = "$ref" + ref = "$ref" bundled = {} for k, v in schema.items(): + newkeys = [*(keys or []), k] + key_path = ".".join(newkeys) if isinstance(v, dict): - if list(v.keys()) == [key] and v[key].startswith("urn:uwtools:"): + if list(v.keys()) == [ref] and v[ref].startswith("urn:uwtools:"): # i.e. the current key's value is of the form: {"$ref": "urn:uwtools:.*"} - bundled[k] = bundle(_registry().get_or_retrieve(v[key]).value.contents) + uri = v[ref] + log.debug("Bundling referenced schema %s at key path: %s", uri, key_path) + bundled[k] = bundle(_registry().get_or_retrieve(uri).value.contents, newkeys) else: - bundled[k] = bundle(v) + log.debug("Bundling dict value at key path: %s", key_path) + bundled[k] = bundle(v, newkeys) else: + log.debug("Bundling %s value at key path: %s", type(v).__name__, key_path) bundled[k] = v return bundled -def get_schema_file(schema_name: str) -> Path: +def internal_schema_file(schema_name: str) -> Path: """ - Return the path to the JSON Schema file for a given name. + Return the path to the internal JSON Schema file for a given driver name. :param schema_name: Name of uwtools schema to validate the config against. """ return resource_path("jsonschema") / f"{schema_name}.jsonschema" -def validate(schema: dict, config: dict) -> bool: +def validate(schema: dict, desc: str, config: dict) -> bool: """ Report any errors arising from validation of the given config against the given JSON Schema. :param schema: The JSON Schema to use for validation. + :param desc: A description of the config being validated, for logging. :param config: The config to validate. :return: Did the YAML file conform to the schema? """ errors = _validation_errors(config, schema) log_method = log.error if errors else log.info - log_msg = "%s UW schema-validation error%s found" - log_method(log_msg, len(errors), "" if len(errors) == 1 else "s") + log_msg = "%s UW schema-validation error%s found in %s" + log_method(log_msg, len(errors), "" if len(errors) == 1 else "s", desc) for error in errors: log.error("Error at %s:", " -> ".join(str(k) for k in error.path)) log.error("%s%s", INDENT, error.message) @@ -69,36 +77,37 @@ def validate(schema: dict, config: dict) -> bool: def validate_internal( - schema_name: str, config: Optional[Union[dict, YAMLConfig, Path]] = None + schema_name: str, desc: str, config: Optional[Union[dict, YAMLConfig, Path]] = None ) -> None: """ Validate a config against a uwtools-internal schema. :param schema_name: Name of uwtools schema to validate the config against. + :param desc: A description of the config being validated, for logging. :param config: The config to validate. :raises: UWConfigError if config fails validation. """ - log.info("Validating config against internal schema: %s", schema_name) - schema_file = get_schema_file(schema_name) - log.debug("Using schema file: %s", schema_file) - validate_external(config=config, schema_file=schema_file) + validate_external(config=config, schema_file=internal_schema_file(schema_name), desc=desc) def validate_external( - schema_file: Path, config: Optional[Union[dict, YAMLConfig, Path]] = None + schema_file: Path, desc: str, config: Optional[Union[dict, YAMLConfig, Path]] = None ) -> None: """ Validate a YAML config against the JSON Schema in the given schema file. :param schema_file: The JSON Schema file to use for validation. + :param desc: A description of the config being validated, for logging. :param config: The config to validate. :raises: UWConfigError if config fails validation. """ + if not str(schema_file).startswith(str(resource_path())): + log.debug("Using schema file: %s", schema_file) with open(schema_file, "r", encoding="utf-8") as f: schema = json.load(f) cfgobj = _prep_config(config) - if not validate(schema=schema, config=cfgobj.data): + if not validate(schema=schema, desc=desc, config=cfgobj.data): raise UWConfigError("YAML validation errors") diff --git a/src/uwtools/drivers/chgres_cube.py b/src/uwtools/drivers/chgres_cube.py index 669860b07..1cf6dca67 100644 --- a/src/uwtools/drivers/chgres_cube.py +++ b/src/uwtools/drivers/chgres_cube.py @@ -59,7 +59,7 @@ def namelist_file(self): config_class=NMLConfig, config_values=namelist, path=path, - schema=self._namelist_schema(), + schema=self.namelist_schema(), ) @tasks diff --git a/src/uwtools/drivers/driver.py b/src/uwtools/drivers/driver.py index 1a60a6d14..750a44b3d 100644 --- a/src/uwtools/drivers/driver.py +++ b/src/uwtools/drivers/driver.py @@ -21,7 +21,7 @@ from uwtools.config.tools import walk_key_path from uwtools.config.validator import ( bundle, - get_schema_file, + internal_schema_file, validate, validate_external, validate_internal, @@ -67,7 +67,8 @@ def __init__( raise UWConfigError("Required '%s' block missing in config" % self.driver_name()) from e if controller: self._config[STR.rundir] = self._config_intermediate[controller][STR.rundir] - self._validate(schema_file) + self.schema_file = schema_file + self._validate() dryrun(enable=dry_run) def __repr__(self) -> str: @@ -106,14 +107,14 @@ def rundir(self) -> Path: @classmethod def schema(cls) -> dict: """ - Return the driver's schema. + Return the driver's internal schema. """ - with open(get_schema_file(schema_name=cls._schema_name()), "r", encoding="utf-8") as f: + with open(internal_schema_file(schema_name=cls._schema_name()), "r", encoding="utf-8") as f: return bundle(json.load(f)) def taskname(self, suffix: str) -> str: """ - Return a common tag for graph-task log messages. + Return a common tag for task-related log messages. :param suffix: Log-string suffix. """ @@ -160,7 +161,7 @@ def _create_user_updated_config( else: config = user_values dump = partial(config_class.dump_dict, config, path) - if validate(schema=schema or {"type": "object"}, config=config): + if validate(schema=schema or {"type": "object"}, desc="user-updated config", config=config): dump() log.debug(f"Wrote config to {path}") else: @@ -175,9 +176,7 @@ def driver_name(cls) -> str: The name of this driver. """ - # Private helper methods - - def _namelist_schema( + def namelist_schema( self, config_keys: Optional[list[str]] = None, schema_keys: Optional[list[str]] = None ) -> dict: """ @@ -191,7 +190,7 @@ def _namelist_schema( for config_key in config_keys or [STR.namelist]: nmlcfg = nmlcfg[config_key] if nmlcfg.get(STR.validate, True): - schema_file = get_schema_file(schema_name=self._schema_name()) + schema_file = self.schema_file or internal_schema_file(schema_name=self._schema_name()) with open(schema_file, "r", encoding="utf-8") as f: schema = json.load(f) for schema_key in schema_keys or [ @@ -205,6 +204,8 @@ def _namelist_schema( schema = schema[schema_key] return schema + # Private helper methods + @classmethod def _schema_name(cls) -> str: """ @@ -212,17 +213,20 @@ def _schema_name(cls) -> str: """ return cls.driver_name().replace("_", "-") - def _validate(self, schema_file: Optional[Path] = None) -> None: + def _validate(self) -> None: """ Perform all necessary schema validation. - :param schema_file: The JSON Schema file to use for validation. :raises: UWConfigError if config fails validation. """ - if schema_file: - validate_external(schema_file=schema_file, config=self._config_intermediate) + kwargs: dict = { + "config": self._config_intermediate, + "desc": "%s config" % self.driver_name(), + } + if self.schema_file: + validate_external(schema_file=self.schema_file, **kwargs) else: - validate_internal(schema_name=self._schema_name(), config=self._config_intermediate) + validate_internal(schema_name=self._schema_name(), **kwargs) class AssetsCycleBased(Assets): @@ -491,15 +495,16 @@ def _scheduler(self) -> JobScheduler: """ return JobScheduler.get_scheduler(self._run_resources) - def _validate(self, schema_file: Optional[Path] = None) -> None: + def _validate(self) -> None: """ Perform all necessary schema validation. - :param schema_file: The JSON Schema file to use for validation. :raises: UWConfigError if config fails validation. """ - Assets._validate(self, schema_file) - validate_internal(schema_name=STR.platform, config=self._config_intermediate) + Assets._validate(self) + validate_internal( + schema_name=STR.platform, desc="platform config", config=self._config_intermediate + ) def _write_runscript(self, path: Path, envvars: Optional[dict[str, str]] = None) -> None: """ diff --git a/src/uwtools/drivers/esg_grid.py b/src/uwtools/drivers/esg_grid.py index 0d77a7da8..bcc2894b4 100644 --- a/src/uwtools/drivers/esg_grid.py +++ b/src/uwtools/drivers/esg_grid.py @@ -35,7 +35,7 @@ def namelist_file(self): config_class=NMLConfig, config_values=self.config[STR.namelist], path=path, - schema=self._namelist_schema(schema_keys=["$defs", "namelist_content"]), + schema=self.namelist_schema(schema_keys=["$defs", "namelist_content"]), ) @tasks diff --git a/src/uwtools/drivers/filter_topo.py b/src/uwtools/drivers/filter_topo.py index 3cb396a5d..68261a5f7 100644 --- a/src/uwtools/drivers/filter_topo.py +++ b/src/uwtools/drivers/filter_topo.py @@ -45,7 +45,7 @@ def namelist_file(self): config_class=NMLConfig, config_values=self.config[STR.namelist], path=path, - schema=self._namelist_schema(), + schema=self.namelist_schema(), ) @tasks diff --git a/src/uwtools/drivers/fv3.py b/src/uwtools/drivers/fv3.py index e417f58d1..e19843aa9 100644 --- a/src/uwtools/drivers/fv3.py +++ b/src/uwtools/drivers/fv3.py @@ -124,7 +124,7 @@ def namelist_file(self): config_class=NMLConfig, config_values=self.config[STR.namelist], path=path, - schema=self._namelist_schema(), + schema=self.namelist_schema(), ) @tasks diff --git a/src/uwtools/drivers/mpas.py b/src/uwtools/drivers/mpas.py index c1953f822..96005a78f 100644 --- a/src/uwtools/drivers/mpas.py +++ b/src/uwtools/drivers/mpas.py @@ -63,7 +63,7 @@ def namelist_file(self): config_class=NMLConfig, config_values=namelist, path=path, - schema=self._namelist_schema(), + schema=self.namelist_schema(), ) # Public helper methods diff --git a/src/uwtools/drivers/mpas_init.py b/src/uwtools/drivers/mpas_init.py index 47d954fbd..be4ec4320 100644 --- a/src/uwtools/drivers/mpas_init.py +++ b/src/uwtools/drivers/mpas_init.py @@ -65,7 +65,7 @@ def namelist_file(self): config_class=NMLConfig, config_values=namelist, path=path, - schema=self._namelist_schema(), + schema=self.namelist_schema(), ) # Public helper methods diff --git a/src/uwtools/drivers/sfc_climo_gen.py b/src/uwtools/drivers/sfc_climo_gen.py index 035ccc07f..de78a50d8 100644 --- a/src/uwtools/drivers/sfc_climo_gen.py +++ b/src/uwtools/drivers/sfc_climo_gen.py @@ -38,7 +38,7 @@ def namelist_file(self): config_class=NMLConfig, config_values=self.config[STR.namelist], path=path, - schema=self._namelist_schema(), + schema=self.namelist_schema(), ) @tasks diff --git a/src/uwtools/drivers/upp.py b/src/uwtools/drivers/upp.py index eed851355..60ff373af 100644 --- a/src/uwtools/drivers/upp.py +++ b/src/uwtools/drivers/upp.py @@ -56,7 +56,7 @@ def namelist_file(self): config_class=NMLConfig, config_values=self.config[STR.namelist], path=path, - schema=self._namelist_schema(), + schema=self.namelist_schema(), ) @tasks diff --git a/src/uwtools/fs.py b/src/uwtools/fs.py index c5bd29b68..5eb067099 100644 --- a/src/uwtools/fs.py +++ b/src/uwtools/fs.py @@ -87,7 +87,7 @@ def _set_config_block(self) -> None: log.debug("Following config key '%s'", key) cfg = cfg[key] if not isinstance(cfg, dict): - msg = "Expected block not found at key path: %s" % " -> ".join(self._keys) + msg = "Expected block not found at key path: %s" % ".".join(self._keys) raise UWConfigError(msg) self._config = cfg @@ -111,7 +111,7 @@ def _validate(self) -> None: :raises: UWConfigError if config fails validation. """ - validate_internal(schema_name=self._schema, config=self._config) + validate_internal(schema_name=self._schema, desc="fs config", config=self._config) class FileStager(Stager): diff --git a/src/uwtools/rocoto.py b/src/uwtools/rocoto.py index 4bfb6fb3b..6d5c1c6e3 100644 --- a/src/uwtools/rocoto.py +++ b/src/uwtools/rocoto.py @@ -62,7 +62,7 @@ def validate_rocoto_xml_string(xml: str) -> bool: valid: bool = schema.validate(tree) nerr = len(schema.error_log) log_method = log.info if valid else log.error - log_method("%s Rocoto validation error%s found", nerr, "" if nerr == 1 else "s") + log_method("%s Rocoto XML validation error%s found", nerr, "" if nerr == 1 else "s") for err in list(schema.error_log): log.error(err) if not valid: @@ -359,7 +359,7 @@ def _config_validate(self, config: Union[dict, YAMLConfig, Optional[Path]]) -> N :raises: UWConfigError if config fails validation. """ schema_file = resource_path("jsonschema/rocoto.jsonschema") - validate_yaml(schema_file=schema_file, config=config) + validate_yaml(schema_file=schema_file, desc="Rocoto config", config=config) @property def _doctype(self) -> Optional[str]: diff --git a/src/uwtools/tests/api/test_config.py b/src/uwtools/tests/api/test_config.py index 803f35747..a9c43cb9a 100644 --- a/src/uwtools/tests/api/test_config.py +++ b/src/uwtools/tests/api/test_config.py @@ -126,6 +126,7 @@ def test_validate(cfg): assert config.validate(**kwargs) is False _validate_external.assert_called_with( schema_file=Path(kwargs["schema_file"]), + desc="config", config=kwargs["config"], ) @@ -138,4 +139,6 @@ def test_validate_config_file(cast, tmp_path): kwargs: dict = {"schema_file": "schema-file", "config": cast(cfg)} with patch.object(config, "_validate_external", return_value=True) as _validate_external: assert config.validate(**kwargs) - _validate_external.assert_called_once_with(schema_file=Path(kwargs["schema_file"]), config=cfg) + _validate_external.assert_called_once_with( + schema_file=Path(kwargs["schema_file"]), desc="config", config=cfg + ) diff --git a/src/uwtools/tests/api/test_drivers.py b/src/uwtools/tests/api/test_drivers.py index 231ba131c..b45ebaeb3 100644 --- a/src/uwtools/tests/api/test_drivers.py +++ b/src/uwtools/tests/api/test_drivers.py @@ -65,6 +65,7 @@ def test_api_execute(module): "dry_run": False, "graph_file": "/some/g.dot", "key_path": None, + "schema_file": None, "stdin_ok": True, "task": "foo", } diff --git a/src/uwtools/tests/config/test_validator.py b/src/uwtools/tests/config/test_validator.py index 983c7abf0..c7f58b3d3 100644 --- a/src/uwtools/tests/config/test_validator.py +++ b/src/uwtools/tests/config/test_validator.py @@ -124,7 +124,8 @@ def write_as_json(data: dict[str, Any], path: Path) -> Path: # Test functions -def test_bundle(): +def test_bundle(caplog): + log.setLevel(logging.DEBUG) schema = {"fruit": {"$ref": "urn:uwtools:a"}, "flowers": None} with patch.object(validator, "_registry") as _registry: outer, inner = Mock(), Mock() @@ -137,21 +138,30 @@ def test_bundle(): "urn:uwtools:a", "urn:uwtools:attrs", ] - - -def test_get_schema_file(): + for msg in [ + "Bundling referenced schema urn:uwtools:a at key path: fruit", + "Bundling referenced schema urn:uwtools:attrs at key path: fruit.a", + "Bundling str value at key path: fruit.a.name", + "Bundling dict value at key path: fruit.b", + "Bundling str value at key path: fruit.b.name", + "Bundling NoneType value at key path: flowers", + ]: + assert logged(caplog, msg) + + +def test_internal_schema_file(): with patch.object(validator, "resource_path", return_value=Path("/foo/bar")): - assert validator.get_schema_file("baz") == Path("/foo/bar/baz.jsonschema") + assert validator.internal_schema_file("baz") == Path("/foo/bar/baz.jsonschema") def test_validate(config, schema): - assert validator.validate(schema=schema, config=config) + assert validator.validate(schema=schema, desc="test", config=config) def test_validate_fail_bad_enum_val(caplog, config, schema): log.setLevel(logging.INFO) config["color"] = "yellow" # invalid enum value - assert not validator.validate(schema=schema, config=config) + assert not validator.validate(schema=schema, desc="test", config=config) assert any(x for x in caplog.records if "1 UW schema-validation error found" in x.message) assert any(x for x in caplog.records if "'yellow' is not one of" in x.message) @@ -159,7 +169,7 @@ def test_validate_fail_bad_enum_val(caplog, config, schema): def test_validate_fail_bad_number_val(caplog, config, schema): log.setLevel(logging.INFO) config["number"] = "string" # invalid number value - assert not validator.validate(schema=schema, config=config) + assert not validator.validate(schema=schema, desc="test", config=config) assert any(x for x in caplog.records if "1 UW schema-validation error found" in x.message) assert any(x for x in caplog.records if "'string' is not of type 'number'" in x.message) @@ -167,7 +177,7 @@ def test_validate_fail_bad_number_val(caplog, config, schema): def test_validate_internal_no(caplog, schema_file): with patch.object(validator, "resource_path", return_value=schema_file.parent): with raises(UWConfigError) as e: - validator.validate_internal(schema_name="a", config={"color": "orange"}) + validator.validate_internal(schema_name="a", desc="test", config={"color": "orange"}) assert logged(caplog, "Error at color:") assert logged(caplog, " 'orange' is not one of ['blue', 'red']") assert str(e.value) == "YAML validation errors" @@ -175,14 +185,14 @@ def test_validate_internal_no(caplog, schema_file): def test_validate_internal_ok(schema_file): with patch.object(validator, "resource_path", return_value=schema_file.parent): - validator.validate_internal(schema_name="a", config={"color": "blue"}) + validator.validate_internal(schema_name="a", desc="test", config={"color": "blue"}) def test_validate_external(assets, config, schema): schema_file, _, cfgobj = assets with patch.object(validator, "validate") as validate: - validator.validate_external(schema_file=schema_file, config=cfgobj) - validate.assert_called_once_with(schema=schema, config=config) + validator.validate_external(schema_file=schema_file, desc="test", config=cfgobj) + validate.assert_called_once_with(schema=schema, desc="test", config=config) def test_prep_config_cfgobj(prep_config_dict): diff --git a/src/uwtools/tests/drivers/test_driver.py b/src/uwtools/tests/drivers/test_driver.py index 9c80c7769..48d72c67e 100644 --- a/src/uwtools/tests/drivers/test_driver.py +++ b/src/uwtools/tests/drivers/test_driver.py @@ -243,6 +243,22 @@ def test_Assets_validate_key_path(config, controller_schema): ) +@mark.parametrize("should_pass,t", [(True, "integer"), (False, "string")]) +def test_Assets_validate_schema_file(caplog, should_pass, t, tmp_path): + path = tmp_path / "test.jsonschema" + schema = {"properties": {"concrete": {"properties": {"n": {"type": t}}}}} + with open(path, "w", encoding="utf-8") as f: + json.dump(schema, f) + test = lambda: ConcreteAssetsTimeInvariant(config={"concrete": {"n": 1}}, schema_file=path) + with patch.object(ConcreteAssetsTimeInvariant, "_validate", driver.Assets._validate): + if should_pass: + assert test() + else: + with raises(UWConfigError): + test() + assert regex_logged(caplog, "1 is not of type 'string'") + + @mark.parametrize( "base_file,update_values,expected", [ @@ -284,6 +300,7 @@ def test_Assets__validate_internal(assetsobj): assetsobj._validate(assetsobj) assert validate_internal.call_args_list[0].kwargs == { "schema_name": "concrete", + "desc": "concrete config", "config": assetsobj.config_full, } @@ -295,6 +312,7 @@ def test_Assets__validate_external(config): assetsobj = ConcreteAssetsTimeInvariant(schema_file=schema_file, config=config) assert validate_external.call_args_list[0].kwargs == { "schema_file": schema_file, + "desc": "concrete config", "config": assetsobj.config_full, } @@ -336,6 +354,42 @@ def test_Driver_leadtime(config): assert obj.leadtime == leadtime +def test_Driver_namelist_schema_default(driverobj, tmp_path): + nmlschema = {"properties": {"n": {"type": "integer"}}, "type": "object"} + schema = { + "properties": { + "concrete": {"properties": {"namelist": {"properties": {"update_values": nmlschema}}}} + } + } + schema_path = tmp_path / "test.jsonschema" + with open(schema_path, "w", encoding="utf-8") as f: + json.dump(schema, f) + with patch.object(ConcreteDriverTimeInvariant, "config", new_callable=PropertyMock) as dc: + dc.return_value = {"namelist": {"validate": True}} + with patch.object(driver, "internal_schema_file", return_value=schema_path): + assert driverobj.namelist_schema() == nmlschema + + +def test_Driver_namelist_schema_external(driverobj, tmp_path): + nmlschema = {"properties": {"n": {"type": "integer"}}, "type": "object"} + schema = {"foo": {"bar": nmlschema}} + schema_path = tmp_path / "test.jsonschema" + with open(schema_path, "w", encoding="utf-8") as f: + json.dump(schema, f) + with patch.object(ConcreteDriverTimeInvariant, "config", new_callable=PropertyMock) as dc: + dc.return_value = {"baz": {"qux": {"validate": True}}} + driverobj.schema_file = schema_path + assert nmlschema == driverobj.namelist_schema( + config_keys=["baz", "qux"], schema_keys=["foo", "bar"] + ) + + +def test_Driver_namelist_schema_default_disable(driverobj): + with patch.object(ConcreteDriverTimeInvariant, "config", new_callable=PropertyMock) as dc: + dc.return_value = {"namelist": {"validate": False}} + assert driverobj.namelist_schema() == {"type": "object"} + + @mark.parametrize("batch", [True, False]) def test_Driver_run(batch, driverobj): driverobj._batch = batch @@ -416,43 +470,6 @@ def test_Driver__create_user_updated_config_base_file( assert updated == expected -def test_Driver__namelist_schema_custom(driverobj, tmp_path): - nmlschema = {"properties": {"n": {"type": "integer"}}, "type": "object"} - schema = {"foo": {"bar": nmlschema}} - schema_path = tmp_path / "test.jsonschema" - with open(schema_path, "w", encoding="utf-8") as f: - json.dump(schema, f) - with patch.object(ConcreteDriverTimeInvariant, "config", new_callable=PropertyMock) as dc: - dc.return_value = {"baz": {"qux": {"validate": True}}} - with patch.object(driver, "get_schema_file", return_value=schema_path): - assert ( - driverobj._namelist_schema(config_keys=["baz", "qux"], schema_keys=["foo", "bar"]) - == nmlschema - ) - - -def test_Driver__namelist_schema_default(driverobj, tmp_path): - nmlschema = {"properties": {"n": {"type": "integer"}}, "type": "object"} - schema = { - "properties": { - "concrete": {"properties": {"namelist": {"properties": {"update_values": nmlschema}}}} - } - } - schema_path = tmp_path / "test.jsonschema" - with open(schema_path, "w", encoding="utf-8") as f: - json.dump(schema, f) - with patch.object(ConcreteDriverTimeInvariant, "config", new_callable=PropertyMock) as dc: - dc.return_value = {"namelist": {"validate": True}} - with patch.object(driver, "get_schema_file", return_value=schema_path): - assert driverobj._namelist_schema() == nmlschema - - -def test_Driver__namelist_schema_default_disable(driverobj): - with patch.object(ConcreteDriverTimeInvariant, "config", new_callable=PropertyMock) as dc: - dc.return_value = {"namelist": {"validate": False}} - assert driverobj._namelist_schema() == {"type": "object"} - - def test_Driver__run_resources_fail(driverobj): del driverobj._config_intermediate["platform"] with raises(UWConfigError) as e: @@ -540,10 +557,12 @@ def test_Driver__validate_internal(assetsobj): assetsobj._validate(assetsobj) assert validate_internal.call_args_list[0].kwargs == { "schema_name": "concrete", + "desc": "concrete config", "config": assetsobj.config_full, } assert validate_internal.call_args_list[1].kwargs == { "schema_name": "platform", + "desc": "platform config", "config": assetsobj.config_full, } @@ -555,6 +574,7 @@ def test_Driver__validate_external(config): assetsobj = ConcreteAssetsTimeInvariant(schema_file=schema_file, config=config) assert validate_external.call_args_list[0].kwargs == { "schema_file": schema_file, + "desc": "concrete config", "config": assetsobj.config_full, } diff --git a/src/uwtools/tests/test_cli.py b/src/uwtools/tests/test_cli.py index 09bab82e0..d66f9f7f6 100644 --- a/src/uwtools/tests/test_cli.py +++ b/src/uwtools/tests/test_cli.py @@ -373,7 +373,7 @@ def test__dispatch_config_validate_config_obj(): STR.schemafile: _dispatch_config_validate_args[STR.schemafile], STR.config: _dispatch_config_validate_args[STR.infile], } - _validate_external.assert_called_once_with(**_validate_external_args) + _validate_external.assert_called_once_with(**_validate_external_args, desc="config") @mark.parametrize( @@ -582,6 +582,7 @@ def test__dispatch_to_driver(hours): "dry_run": False, "graph_file": None, "key_path": ["foo", "bar"], + "schema_file": None, "show_schema": False, "stdin_ok": True, } @@ -596,6 +597,7 @@ def test__dispatch_to_driver(hours): dry_run=False, graph_file=None, key_path=["foo", "bar"], + schema_file=None, task="foo", stdin_ok=True, ) diff --git a/src/uwtools/tests/test_fs.py b/src/uwtools/tests/test_fs.py index b83a4fbdf..4d9189f6c 100644 --- a/src/uwtools/tests/test_fs.py +++ b/src/uwtools/tests/test_fs.py @@ -104,7 +104,7 @@ def test_Linker(assets, source): @mark.parametrize("source", ("dict", "file")) -def test_Stager__config_block_fail_bad_keypath(assets, source): +def test_Stager__config_block_fail_bad_key_path(assets, source): dstdir, cfgdict, cfgfile = assets config = cfgdict if source == "dict" else cfgfile with raises(UWConfigError) as e: @@ -118,4 +118,4 @@ def test_Stager__config_block_fails_bad_type(assets, val): cfgdict["a"]["b"] = val with raises(UWConfigError) as e: ConcreteStager(target_dir=dstdir, config=cfgdict, keys=["a", "b"]) - assert str(e.value) == "Expected block not found at key path: a -> b" + assert str(e.value) == "Expected block not found at key path: a.b" diff --git a/src/uwtools/tests/utils/test_api.py b/src/uwtools/tests/utils/test_api.py index 374cd8cf4..6e6123bab 100644 --- a/src/uwtools/tests/utils/test_api.py +++ b/src/uwtools/tests/utils/test_api.py @@ -21,6 +21,7 @@ def execute_kwargs(): "dry_run": False, "graph_file": "/path/to/g.dot", "key_path": None, + "schema_file": None, "stdin_ok": True, } diff --git a/src/uwtools/utils/api.py b/src/uwtools/utils/api.py index 548b3306b..38ac2a28f 100644 --- a/src/uwtools/utils/api.py +++ b/src/uwtools/utils/api.py @@ -52,6 +52,7 @@ def execute( dry_run: bool = False, graph_file: Optional[Union[Path, str]] = None, key_path: Optional[list[str]] = None, + schema_file: Optional[Union[Path, str]] = None, stdin_ok: bool = False, ) -> bool: return _execute( @@ -64,6 +65,7 @@ def execute( dry_run=dry_run, graph_file=graph_file, key_path=key_path, + schema_file=schema_file, stdin_ok=stdin_ok, ) @@ -75,6 +77,7 @@ def execute_cycle( dry_run: bool = False, graph_file: Optional[Union[Path, str]] = None, key_path: Optional[list[str]] = None, + schema_file: Optional[Union[Path, str]] = None, stdin_ok: bool = False, ) -> bool: return _execute( @@ -87,6 +90,7 @@ def execute_cycle( dry_run=dry_run, graph_file=graph_file, key_path=key_path, + schema_file=schema_file, stdin_ok=stdin_ok, ) @@ -99,6 +103,7 @@ def execute_cycle_leadtime( dry_run: bool = False, graph_file: Optional[Union[Path, str]] = None, key_path: Optional[list[str]] = None, + schema_file: Optional[Union[Path, str]] = None, stdin_ok: bool = False, ) -> bool: return _execute( @@ -111,6 +116,7 @@ def execute_cycle_leadtime( dry_run=dry_run, graph_file=graph_file, key_path=key_path, + schema_file=schema_file, stdin_ok=stdin_ok, ) @@ -146,6 +152,7 @@ def _execute( dry_run: bool = False, graph_file: Optional[Union[Path, str]] = None, key_path: Optional[list[str]] = None, + schema_file: Optional[Union[Path, str]] = None, stdin_ok: bool = False, ) -> bool: """ @@ -163,6 +170,7 @@ def _execute( :param dry_run: Do not run the executable, just report what would have been done. :param graph_file: Write Graphviz DOT output here. :param key_path: Path of keys to subsection of config file. + :param schema_file: The JSON Schema file to use for validation. :param stdin_ok: OK to read from stdin? :return: ``True`` if task completes without raising an exception. """ @@ -170,6 +178,7 @@ def _execute( config=ensure_data_source(str2path(config), stdin_ok), dry_run=dry_run, key_path=key_path, + schema_file=schema_file, ) accepted = set(getfullargspec(driver_class).args) for arg in ["batch", "cycle", "leadtime"]: