Skip to content

Commit

Permalink
fv3-schema-update (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
maddenp-noaa authored Feb 7, 2024
1 parent bd64cb0 commit b8c2081
Show file tree
Hide file tree
Showing 9 changed files with 632 additions and 127 deletions.
2 changes: 1 addition & 1 deletion docs/sections/user_guide/uw_yaml/forecast_yaml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ The MPI command used to run the model executable. Typical options are ``srun``,

``scheduler:``
^^^^^^^^^^^^^^
The name of the batch system. Supported options are ``lfs``, ``pbs``, and ``slurm``.
The name of the batch system. Supported options are ``lsf``, ``pbs``, and ``slurm``.

The ``preprocessing:`` block
----------------------------
Expand Down
22 changes: 9 additions & 13 deletions src/uwtools/drivers/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ def run_cmd(self) -> str:
:return: Collated string that contains MPI command, runtime arguments, and exec name.
"""
components = [
self._platform_config.get("mpicmd"), # MPI run program
*[str(x) for x in self._config["runtime_info"].get("mpi_args", [])], # MPI arguments
self._platform_config["mpicmd"], # MPI run program
*[
str(x) for x in self._config.get("runtime_info", {}).get("mpi_args", [])
], # MPI arguments
self._config["executable"], # NWP tool executable name
]
return " ".join(filter(None, components))
Expand Down Expand Up @@ -149,28 +151,22 @@ def _create_user_updated_config(
config_class: Type[Config], config_values: dict, output_path: OptionalPath
) -> None:
"""
The standard procedure for updating a file of a configuration class type with user-provided
values.
Create a config from a base file, user-provided values, of a combination of the two.
:param config_class: The Config subclass matching the configure file type.
:param config_values: The in-memory configuration object to update base values with.
:param config_class: The Config subclass matching the config type.
:param config_values: The configuration object to update base values with.
:param output_path: Optional path to dump file to.
"""

# User-supplied values that override any settings in the base
# file.
user_values = config_values.get("update_values", {})

if base_file := config_values.get("base_file"):
config_obj = config_class(base_file)
config_obj.update_values(user_values)
config_obj.dereference()
config_obj.dump(output_path)
else:
config_class.dump_dict(cfg=user_values, path=output_path)

msg = f"Configure file {output_path} created"
log.info(msg)
if output_path:
log.info(f"Wrote config to {output_path}")

def _validate(self) -> bool:
"""
Expand Down
4 changes: 2 additions & 2 deletions src/uwtools/drivers/forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def resources(self) -> Mapping:
"""

return {
"account": self._experiment_config["user"]["account"],
"account": self._experiment_config["platform"]["account"],
"scheduler": self._experiment_config["platform"]["scheduler"],
**self._config["jobinfo"],
}
Expand Down Expand Up @@ -238,7 +238,7 @@ def _mpi_env_variables(self, delimiter: str = " ") -> str:
"""
envvars = {
"KMP_AFFINITY": "scatter",
"OMP_NUM_THREADS": self._config["runtime_info"].get("threads", 1),
"OMP_NUM_THREADS": self._config.get("runtime_info", {}).get("threads", 1),
"OMP_STACKSIZE": "512m",
"MPI_TYPE_DEPTH": 20,
"ESMF_RUNTIME_COMPLIANCECHECK": "OFF:depth=4",
Expand Down
Loading

0 comments on commit b8c2081

Please sign in to comment.