Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UW-501 / UW-502 FV3 graph-based driver implementation #408

Merged
merged 147 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 140 commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
e3d59ee
Add iotaa dependency
maddenp-noaa Jan 30, 2024
085b76a
Remove ??? methods
maddenp-noaa Jan 30, 2024
c3fcedc
WIP
maddenp-noaa Jan 31, 2024
5139935
Add dag.py
maddenp-noaa Jan 31, 2024
9230d7d
WIP on schema
maddenp-noaa Jan 31, 2024
d0fd916
Fix 'platform' schema
maddenp-noaa Jan 31, 2024
1955dd6
Fix 'preprocessing' schema
maddenp-noaa Jan 31, 2024
788cafc
Fix 'user' schema
maddenp-noaa Jan 31, 2024
3725633
WIP
maddenp-noaa Jan 31, 2024
ec1b705
WIP on schema
maddenp-noaa Jan 31, 2024
eb35246
Merge branch 'main' into UW-449
maddenp-noaa Jan 31, 2024
5fafa4d
Move validator() to test support
maddenp-noaa Jan 31, 2024
9d557b5
WIP on schema tests
maddenp-noaa Jan 31, 2024
bdbec5b
lfs -> lsf
maddenp-noaa Feb 1, 2024
f06cf8b
WIP
maddenp-noaa Feb 1, 2024
5d14181
WIP
maddenp-noaa Feb 1, 2024
57757de
WIP
maddenp-noaa Feb 1, 2024
6ccb584
WIP
maddenp-noaa Feb 1, 2024
309f4ff
WIP
maddenp-noaa Feb 1, 2024
c7c076a
WIP
maddenp-noaa Feb 1, 2024
f375db0
Docstring stubs
maddenp-noaa Feb 1, 2024
2869bfc
Fix batch-submit command
maddenp-noaa Feb 1, 2024
44089ff
Abort if driver config fails validation
maddenp-noaa Feb 1, 2024
ff40a8c
Add jobinfo to FV3Forecast.jsonschema
maddenp-noaa Feb 1, 2024
3eaafc9
Capture stderr from job submit cmd
maddenp-noaa Feb 1, 2024
135bd89
Move cycle param to FV3Forecast constructor
maddenp-noaa Feb 1, 2024
a8db65d
is_file, not is_dir
maddenp-noaa Feb 1, 2024
9fee5fd
WIP
maddenp-noaa Feb 1, 2024
c4e926b
Tests pass
maddenp-noaa Feb 2, 2024
6243f4d
Use iotaa 0.5.0
maddenp-noaa Feb 2, 2024
78baf4a
Add tasknames()
maddenp-noaa Feb 2, 2024
db6a8fb
Wire up tasknames to CLI
maddenp-noaa Feb 2, 2024
995ceb4
WIP
maddenp-noaa Feb 2, 2024
6b91df1
Add --task to uw forecast run
maddenp-noaa Feb 2, 2024
e123850
WIP
maddenp-noaa Feb 2, 2024
3e1e75f
Formatting
maddenp-noaa Feb 2, 2024
0824759
Delinting
maddenp-noaa Feb 2, 2024
d1ef020
Tests pass
maddenp-noaa Feb 2, 2024
546d1ee
CLI fixes
maddenp-noaa Feb 2, 2024
2fb029a
WIP
maddenp-noaa Feb 2, 2024
beba92b
WIP
maddenp-noaa Feb 2, 2024
fce80f4
WIP
maddenp-noaa Feb 2, 2024
565b2fc
Show default task in CLI
maddenp-noaa Feb 3, 2024
337e6d1
Work on provisioned_run_directory
maddenp-noaa Feb 3, 2024
8fcd1cf
Fix
maddenp-noaa Feb 3, 2024
7eaa028
WIP
maddenp-noaa Feb 3, 2024
9ecb899
WIP
maddenp-noaa Feb 3, 2024
4cb1837
Renames
maddenp-noaa Feb 5, 2024
b3cefde
WIP
maddenp-noaa Feb 5, 2024
fef3ad5
Delinting
maddenp-noaa Feb 5, 2024
63a7afa
Tests pass
maddenp-noaa Feb 5, 2024
06e9bec
WIP
maddenp-noaa Feb 5, 2024
fcd9556
WIP
maddenp-noaa Feb 5, 2024
0cac1db
Use only first line of task docstring
maddenp-noaa Feb 5, 2024
90ced63
Merge branch 'main' into UW-449
maddenp-noaa Feb 7, 2024
a25bf45
Changes to uwtools.drivers.fv3 from main
maddenp-noaa Feb 7, 2024
86f0484
Merge fv3 schemas
maddenp-noaa Feb 7, 2024
77e707e
Fix tests
maddenp-noaa Feb 7, 2024
6ac936b
forecast -> fv3 in yaml
maddenp-noaa Feb 7, 2024
257cb3d
Fix make clean-devenv target
maddenp-noaa Feb 8, 2024
8128e85
Use iotaa 0.6.*
maddenp-noaa Feb 8, 2024
8021cc4
Make run_directory() -> _run_directory() private task
maddenp-noaa Feb 8, 2024
b0e6ae4
Remove refs() call on @tasks function
maddenp-noaa Feb 8, 2024
8307079
Delinting
maddenp-noaa Feb 8, 2024
20f9663
Make batch/local run tasks private
maddenp-noaa Feb 8, 2024
dec5742
Private run_cmd() -> _run_cmd()
maddenp-noaa Feb 8, 2024
7ba6443
WIP
maddenp-noaa Feb 8, 2024
c0738a0
Simplify get_scheduler()
maddenp-noaa Feb 8, 2024
948625b
Work on execution block
maddenp-noaa Feb 8, 2024
545f0e6
Work on execution block
maddenp-noaa Feb 8, 2024
37d5650
Work on execution block
maddenp-noaa Feb 8, 2024
dc9424b
Work on execution block
maddenp-noaa Feb 8, 2024
5726215
Work on execution block
maddenp-noaa Feb 8, 2024
2827d7f
Add diag_table task
maddenp-noaa Feb 8, 2024
6f1d4b1
Add namelist_file task
maddenp-noaa Feb 8, 2024
e365117
Tidy up unit tests
maddenp-noaa Feb 8, 2024
716ff66
WIP
maddenp-noaa Feb 8, 2024
dbf32c1
WIP
maddenp-noaa Feb 8, 2024
e700fca
Refactoring
maddenp-noaa Feb 8, 2024
167c7df
WIP
maddenp-noaa Feb 9, 2024
2bcb6ad
WIP
maddenp-noaa Feb 9, 2024
80be089
Add boundary_files task
maddenp-noaa Feb 9, 2024
01795cb
WIP
maddenp-noaa Feb 9, 2024
b951064
Simplify
maddenp-noaa Feb 9, 2024
a5dc8f8
Clean up docstrings
maddenp-noaa Feb 9, 2024
20c17c2
Add restart_directory task
maddenp-noaa Feb 9, 2024
8a8ac1a
WIP
maddenp-noaa Feb 9, 2024
508f1f4
Work on runscript
maddenp-noaa Feb 9, 2024
a0dd02d
Work on scheduler support
maddenp-noaa Feb 9, 2024
e957b8f
Work on scheduler support
maddenp-noaa Feb 9, 2024
4718b0f
Simplify
maddenp-noaa Feb 9, 2024
2eeb53e
Reorder
maddenp-noaa Feb 9, 2024
faa9a77
Work on scheduler support
maddenp-noaa Feb 9, 2024
cef5e69
Work on scheduler support
maddenp-noaa Feb 9, 2024
fcad7c1
Work on scheduler support
maddenp-noaa Feb 9, 2024
7ba4b67
Fix runscript newlines
maddenp-noaa Feb 9, 2024
257532c
Add docstrings
maddenp-noaa Feb 9, 2024
15206b2
WIP
maddenp-noaa Feb 9, 2024
3b38de7
drivercfg -> driver_config
maddenp-noaa Feb 9, 2024
eda8c98
validate_yaml() -> validate_yaml_file()
maddenp-noaa Feb 9, 2024
c9f6355
Undo validate_yaml() -> validate_yaml_file()
maddenp-noaa Feb 9, 2024
12bf56e
WIP
maddenp-noaa Feb 9, 2024
9a626f1
WIP
maddenp-noaa Feb 9, 2024
ebc0063
Restore some tests
maddenp-noaa Feb 9, 2024
9025156
Mutual account/scheduler requirement
maddenp-noaa Feb 9, 2024
b6fae8b
Factor out platform schema
maddenp-noaa Feb 9, 2024
500ceda
Validate both fv3 and platform schemas
maddenp-noaa Feb 9, 2024
cd2de21
Move lateral_boundary_conditions into fv3 block
maddenp-noaa Feb 9, 2024
1d639e2
WIP
maddenp-noaa Feb 9, 2024
4c37ba0
Formatting
maddenp-noaa Feb 9, 2024
c326b4a
Add files_to_copy, files_to_link support
maddenp-noaa Feb 9, 2024
0deb87c
WIP
maddenp-noaa Feb 9, 2024
a5ca2b5
Use keyword arguments
maddenp-noaa Feb 10, 2024
fdda27c
Runscript improvements
maddenp-noaa Feb 10, 2024
51e76f7
Sort directives in scheduler module
maddenp-noaa Feb 10, 2024
902be81
Add envcmds
maddenp-noaa Feb 10, 2024
28221d8
Add export before env vars
maddenp-noaa Feb 10, 2024
14e046b
Use = in slurm directives
maddenp-noaa Feb 10, 2024
b7bb894
Flexible batchargs in fv3.jsonschema
maddenp-noaa Feb 10, 2024
93434a7
Make queue optional
maddenp-noaa Feb 10, 2024
7f20039
Improve test of tagged scalars
maddenp-noaa Feb 10, 2024
dd4796c
WIP
maddenp-noaa Feb 10, 2024
bb04d1c
Renaming
maddenp-noaa Feb 10, 2024
29b2a75
Renaming
maddenp-noaa Feb 10, 2024
478f7a8
Support unmanaged scheduler directives
maddenp-noaa Feb 10, 2024
da2598c
Use copy() not copyfile() to preserve permissions
maddenp-noaa Feb 10, 2024
9791441
Schema-validation log message
maddenp-noaa Feb 10, 2024
1e17749
Move mpicmd to fv3.execution
maddenp-noaa Feb 10, 2024
0d1a4c4
Remove unused _stage_files()
maddenp-noaa Feb 11, 2024
c12f427
Reorder
maddenp-noaa Feb 11, 2024
b336d77
Tidy up
maddenp-noaa Feb 11, 2024
281ac1e
Revert doc change
maddenp-noaa Feb 11, 2024
f153e7c
Automated doc updates
maddenp-noaa Feb 11, 2024
50fb327
Sphinx mock iotaa
maddenp-noaa Feb 11, 2024
e9d6368
Fix unit tests
maddenp-noaa Feb 11, 2024
3acdf7c
Fixes, permit Jinja expressions in keys, first-class cycle support
maddenp-noaa Feb 12, 2024
927a94a
Parametrize & combine tests
maddenp-noaa Feb 12, 2024
003e5b8
Update docs
maddenp-noaa Feb 12, 2024
657b4f9
Renaming
maddenp-noaa Feb 12, 2024
a5ee690
Fix uw_yaml toc
maddenp-noaa Feb 12, 2024
a03888b
Correct docstring
maddenp-noaa Feb 12, 2024
8eb7019
Remove some pylint suppressors
maddenp-noaa Feb 13, 2024
8a7c40b
Fix CLI doc line wrapping
maddenp-noaa Feb 13, 2024
68dc9c1
Fix typos
maddenp-noaa Feb 13, 2024
1efe13a
Fix typo & use more descriptive variable name
maddenp-noaa Feb 13, 2024
c2474fd
Use iotaa v0.7.1
maddenp-noaa Feb 14, 2024
a94d414
Merge branch 'main' into UW-449
maddenp-noaa Feb 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ TARGETS = clean-devenv devshell docs env format lint meta package test typec

export RECIPE_DIR := $(shell cd ./recipe && pwd)

clean = $(shell $(CONDA_EXE) env remove -n DEV-$(call val,name))
clean = $(info $(shell $(CONDA_EXE) env remove -n DEV-$(call val,name)))
maddenp-noaa marked this conversation as resolved.
Show resolved Hide resolved
spec = $(call val,name)$(2)$(call val,version)$(2)$(call val,$(1))
val = $(shell jq -r .$(1) $(METAJSON))

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
with open("../recipe/meta.json", "r", encoding="utf-8") as f:
_metadata = json.loads(f.read())

autodoc_mock_imports = ["f90nml", "jsonschema", "lxml"]
autodoc_mock_imports = ["f90nml", "iotaa", "jsonschema", "lxml"]
copyright = str(dt.datetime.now().year)
extensions = ["sphinx.ext.autodoc", "sphinx.ext.extlinks", "sphinx.ext.intersphinx"]
extlinks_detect_hardcoded_links = True
Expand Down
14 changes: 6 additions & 8 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,15 @@ Do you already have a Rocoto XML but don't want to run Rocoto to make sure it wo
The Drivers
-----------

The uwtools driver(s) live right there beside the rest of the tools in the CLI and API. These tools will be under development for the foreseeable future, but we do have a forecast driver currently available in beta testing mode.
Drivers for NWP components are available as top-level CLI modes and API modules.

Forecast
^^^^^^^^
FV3
^^^

| **CLI**: ``uw forecast -h``
| **API**: ``import uwtools.api.drivers.forecast``
| **CLI**: ``uw fv3 -h``
| **API**: ``import uwtools.api.drivers.fv3``

This driver is the first of its kind (with many others to come) and takes a few pieces of information from the user --- the model, the time, and a structured YAML --- and runs a forecast via batch job or as an executable. That simple.

We've helped by providing a JSON Schema that allows you to validate your YAML to ensure you've got it right!
Provided with a valid UW YAML configuration file and a forecast-cycle value, ``uw fv3`` can prepare a fully provisioned FV3 run directory, execute FV3 directly, or can submit an FV3 batch job to an HPC scheduler.

Over time, we'll add many other drivers to support a variety of UFS components from pre-processing to post-processing, along with many data assimilation components.

Expand Down
5 changes: 0 additions & 5 deletions docs/sections/user_guide/api/forecast.rst

This file was deleted.

5 changes: 5 additions & 0 deletions docs/sections/user_guide/api/fv3.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
``uwtools.api.fv3``
========================

.. automodule:: uwtools.api.fv3
:members:
2 changes: 1 addition & 1 deletion docs/sections/user_guide/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ API

.. toctree::
config
forecast
fv3
logging
rocoto
template
2 changes: 1 addition & 1 deletion docs/sections/user_guide/cli/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ CLI
:maxdepth: 1

mode_config
mode_forecast
mode_fv3
mode_rocoto
mode_template
4 changes: 2 additions & 2 deletions docs/sections/user_guide/cli/mode_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The ``uw`` mode for handling configuration files (configs).
``compare``
-----------

The ``compare`` mode lets users compare two config files.
The ``compare`` mode lets users compare two config files.

.. code-block:: text

Expand Down Expand Up @@ -148,7 +148,7 @@ The examples that follow use namelist files ``values1.nml`` and ``values2.nml``,
``realize``
-----------

In ``uw`` terminology, to realize a configuration file is to transform it from its raw form into its final, usable state. The ``realize`` mode can build a complete config file from two or more separate files.
In ``uw`` terminology, to realize a configuration file is to transform it from its raw form into its final, usable state. The ``realize`` mode can build a complete config file from two or more separate files.

.. code-block:: text

Expand Down
88 changes: 0 additions & 88 deletions docs/sections/user_guide/cli/mode_forecast.rst

This file was deleted.

102 changes: 102 additions & 0 deletions docs/sections/user_guide/cli/mode_fv3.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
Mode ``fv3``
============

The ``uw`` mode for configuring and running FV3.

.. code-block:: text

$ uw fv3 --help
usage: uw fv3 [-h] TASK ...

Execute FV3 tasks

Optional arguments:
-h, --help
Show help and exit

Positional arguments:
TASK
boundary_files
The FV3 lateral boundary-condition files
diag_table
The FV3 diag_table file
field_table
The FV3 field_table file
files_copied
Files copied for FV3 run
files_linked
Files linked for FV3 run
model_configure
The FV3 model_configure file
namelist_file
The FV3 namelist file
provisioned_run_directory
The run directory provisioned with all required content
restart_directory
The FV3 RESTART directory
run
FV3 run execution
runscript
A runscript suitable for submission to the scheduler

All tasks take the same arguments. For example:

.. code-block:: text

$ uw fv3 run --help
usage: uw fv3 run --config-file PATH --cycle CYCLE [-h] [--batch] [--dry-run] [--debug] [--quiet] [--verbose]

FV3 run execution

Required arguments:
--config-file PATH, -c PATH
Path to config file
--cycle CYCLE
The cycle in ISO8601 format

Optional arguments:
-h, --help
Show help and exit
--batch
Submit run to batch scheduler
--dry-run
Only log info, making no changes
--debug
Print all log messages, plus any unhandled exception's stack trace (implies --verbose)
--quiet, -q
Print no logging messages
--verbose, -v
Print all logging messages

Examples
^^^^^^^^

The examples use a configuration file named ``config.yaml``. Its contents are described in depth in section :ref:`fv3_yaml`.

* Run FV3 on an interactive node

.. code-block:: text

$ uw fv3 run --config-file config.yaml --cycle 2024-02-11T12

The driver creates a ``runscript`` file in the directory specified by ``run_dir`` in the config and runs it, executing FV3.

* Run FV3 via a batch job

.. code-block:: text

$ uw fv3 run --config-file config.yaml --cycle 2024-02-11T12 --batch

The driver creates a ``runscript`` file in the directory specified by ``run_dir`` in the config and submits it to the batch system. Running with ``--batch`` requires a correctly configured ``platform`` block in ``config,yaml``, as well as appropriate settings in the ``execution`` block under ``fv3``.

* Specifying the ``--dry-run`` flag results in the driver logging messages about actions it would have taken, without actually taking any.

.. code-block:: text

$ uw fv3 run --config-file config.yaml --cycle 2024-02-11T12 --batch --dry-run

* The ``run`` task depends on the other available tasks and executes them as prerequisites. It is possible to execute any task directly, which entails execution of any of *its* depdendencies. For example, to create an FV3 run directory provisioned with all the files, directories, symlinks, etc. required per the configuration file:
maddenp-noaa marked this conversation as resolved.
Show resolved Hide resolved

.. code-block: text

$ uw fv3 provisioned_run_directory --config-file config.yaml --cycle 2024-02-11T12 --batch
4 changes: 2 additions & 2 deletions docs/sections/user_guide/installation.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Installation
============

.. note::
.. note::

Developers should visit the :doc:`Developer Setup <../contributor_guide/developer_setup>` section located in the :doc:`Contributor Guide <../contributor_guide/index>`.

The recommended installation mechanism uses the Python package and virtual-environment manager :conda:`conda<>`. Specifically, these instructions assume use of the :miniforge:`Miniforge<>` variant of :miniconda:`Miniconda<>`, built to use, by default, packages from the :conda-forge:`conda-forge<>` project. Users of the original :miniconda:`Miniconda<>` or the :anaconda:`Anaconda distribution<>` should add the flags ``-c conda-forge --override-channels`` to ``conda`` commands to specify the required package channels.
Expand Down
Loading
Loading