From b18844a96d2d0d36ae92463fbbbb2bcdcef08ed4 Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Tue, 16 Sep 2025 17:29:44 +0000 Subject: [PATCH 1/3] Updating schema and docs for GSI. --- .../user_guide/yaml/components/execution.rst | 6 ++++++ src/uwtools/drivers/stager.py | 11 ++++++++--- .../jsonschema/execution-parallel.jsonschema | 3 +++ src/uwtools/resources/jsonschema/gsi.jsonschema | 14 +++++++++++++- src/uwtools/tests/test_schemas.py | 4 ++-- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/docs/sections/user_guide/yaml/components/execution.rst b/docs/sections/user_guide/yaml/components/execution.rst index 16a3ad1fd..dfce0a163 100644 --- a/docs/sections/user_guide/yaml/components/execution.rst +++ b/docs/sections/user_guide/yaml/components/execution.rst @@ -34,6 +34,7 @@ Example block: - "--export=ALL" - "--ntasks $SLURM_CPUS_ON_NODE" mpicmd: srun + stacksize: 100M threads: 8 batchargs: @@ -83,6 +84,11 @@ mpicmd: The MPI launch program (``mpiexec``, ``srun``, et al.). This entry is only used when configuring parallel components. +stacksize: +"""""""""" + +For drivers implementing support, exports the ``OMP_STACKSIZE`` environment variable to the execution environment, specifying the size of the stack for threads created by OpenMP. The value of this environment takes the form: *size* | *size***B** | *size***K** | *size***M** | *size***G**. + threads: """""""" diff --git a/src/uwtools/drivers/stager.py b/src/uwtools/drivers/stager.py index 0e1823b29..3a3833aa9 100644 --- a/src/uwtools/drivers/stager.py +++ b/src/uwtools/drivers/stager.py @@ -20,7 +20,8 @@ def files_copied(self): """ taskname, config, rundir = self.taskname, self.config, self.rundir # type: ignore[attr-defined] yield taskname("files copied") - yield [Copier(config=config.get("files_to_copy", {}), target_dir=rundir).go()] + files = config.get("files_to_copy", {}) + yield [Copier(config=files, target_dir=rundir).go() if files else None] @tasks def files_hardlinked(self): @@ -29,13 +30,16 @@ def files_hardlinked(self): """ taskname, config, rundir = self.taskname, self.config, self.rundir # type: ignore[attr-defined] yield taskname("files hardlinked") + files = config.get("files_to_hardlink", {}) yield [ Linker( - config=config.get("files_to_hardlink", {}), + config=files, target_dir=rundir, hardlink=True, fallback=STR.copy, ).go() + if files + else None ] @tasks @@ -45,4 +49,5 @@ def files_linked(self): """ taskname, config, rundir = self.taskname, self.config, self.rundir # type: ignore[attr-defined] yield taskname("files linked") - yield [Linker(config=config.get("files_to_link", {}), target_dir=rundir).go()] + files = config.get("files_to_link", {}) + yield [Linker(config=files, target_dir=rundir).go() if files else None] diff --git a/src/uwtools/resources/jsonschema/execution-parallel.jsonschema b/src/uwtools/resources/jsonschema/execution-parallel.jsonschema index 6df557d83..92907a362 100644 --- a/src/uwtools/resources/jsonschema/execution-parallel.jsonschema +++ b/src/uwtools/resources/jsonschema/execution-parallel.jsonschema @@ -22,6 +22,9 @@ "mpicmd": { "type": "string" }, + "stacksize": { + "type": "string" + }, "threads": { "minimum": 1, "type": "integer" diff --git a/src/uwtools/resources/jsonschema/gsi.jsonschema b/src/uwtools/resources/jsonschema/gsi.jsonschema index 8ab0e3d3a..62646771f 100644 --- a/src/uwtools/resources/jsonschema/gsi.jsonschema +++ b/src/uwtools/resources/jsonschema/gsi.jsonschema @@ -50,7 +50,19 @@ "type": "string" }, "update_values": { - "$ref": "urn:uwtools:namelist" + "additionalProperties": { + "additionalProperties": { + "type": [ + "array", + "boolean", + "number", + "string" + ] + }, + "type": "object" + }, + "minProperties": 1, + "type": "object" }, "validate": { "type": "boolean" diff --git a/src/uwtools/tests/test_schemas.py b/src/uwtools/tests/test_schemas.py index d1baf1970..a2b8c3b5c 100644 --- a/src/uwtools/tests/test_schemas.py +++ b/src/uwtools/tests/test_schemas.py @@ -1160,8 +1160,8 @@ def test_schema_gsi_namelist_update_values(gsi_prop): ) # At least one namelist entry is required: assert non_empty_dict(errors({})) - # At least one val/var pair is required: - assert non_empty_dict(errors({"nml": {}})) + # Allow for empty namelist entries: + assert not errors({"nml": {}}) def test_schema_gsi_rundir(gsi_prop): From b0feaf6797f3a2be5145fec6d946a86f1ef5b00e Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Tue, 16 Sep 2025 11:40:48 -0600 Subject: [PATCH 2/3] Fix rst emphasis. --- docs/sections/user_guide/yaml/components/execution.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sections/user_guide/yaml/components/execution.rst b/docs/sections/user_guide/yaml/components/execution.rst index dfce0a163..915c4c9da 100644 --- a/docs/sections/user_guide/yaml/components/execution.rst +++ b/docs/sections/user_guide/yaml/components/execution.rst @@ -87,7 +87,7 @@ The MPI launch program (``mpiexec``, ``srun``, et al.). This entry is only used stacksize: """""""""" -For drivers implementing support, exports the ``OMP_STACKSIZE`` environment variable to the execution environment, specifying the size of the stack for threads created by OpenMP. The value of this environment takes the form: *size* | *size***B** | *size***K** | *size***M** | *size***G**. +For drivers implementing support, exports the ``OMP_STACKSIZE`` environment variable to the execution environment, specifying the size of the stack for threads created by OpenMP. The value of this environment takes the form: *size* | *size*\ **B** | *size*\ **K** | *size*\ **M** | *size*\ **G**. When only *size* is provided, the unit is assumed to be kilobytes. threads: """""""" From 85819a497e899c6d610af1bf4da59b6328582e3b Mon Sep 17 00:00:00 2001 From: Christina Holt <56881914+christinaholtNOAA@users.noreply.github.com> Date: Tue, 16 Sep 2025 12:57:28 -0600 Subject: [PATCH 3/3] Update docs/sections/user_guide/yaml/components/execution.rst Co-authored-by: Paul Madden <136389411+maddenp-cu@users.noreply.github.com> --- docs/sections/user_guide/yaml/components/execution.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sections/user_guide/yaml/components/execution.rst b/docs/sections/user_guide/yaml/components/execution.rst index 915c4c9da..352eef022 100644 --- a/docs/sections/user_guide/yaml/components/execution.rst +++ b/docs/sections/user_guide/yaml/components/execution.rst @@ -87,7 +87,7 @@ The MPI launch program (``mpiexec``, ``srun``, et al.). This entry is only used stacksize: """""""""" -For drivers implementing support, exports the ``OMP_STACKSIZE`` environment variable to the execution environment, specifying the size of the stack for threads created by OpenMP. The value of this environment takes the form: *size* | *size*\ **B** | *size*\ **K** | *size*\ **M** | *size*\ **G**. When only *size* is provided, the unit is assumed to be kilobytes. +For drivers implementing support, exports the ``OMP_STACKSIZE`` environment variable to the execution environment, specifying the size of the stack for threads created by OpenMP. The value takes the form: *size* | *size*\ **B** | *size*\ **K** | *size*\ **M** | *size*\ **G**. When only *size* is provided, the unit is assumed to be kilobytes. threads: """"""""