From f6beef75122606211859932209bbeee21bbb504e Mon Sep 17 00:00:00 2001 From: Christina Holt Date: Sun, 9 Jun 2024 12:31:27 -0600 Subject: [PATCH] Provide a config to the jedi executable. --- src/uwtools/drivers/jedi.py | 25 ++++++++++++++++++++++++- src/uwtools/tests/drivers/test_jedi.py | 12 ++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/uwtools/drivers/jedi.py b/src/uwtools/drivers/jedi.py index 32c8f5553..4cae4a5e8 100644 --- a/src/uwtools/drivers/jedi.py +++ b/src/uwtools/drivers/jedi.py @@ -49,7 +49,7 @@ def configuration_file(self): """ The JEDI YAML configuration file. """ - fn = "jedi.yaml" + fn = self._config_fn yield self._taskname(fn) path = self._rundir / fn yield asset(path, path.is_file) @@ -129,6 +129,13 @@ def validate_only(self): # Private helper methods + @property + def _config_fn(self) -> str: + """ + Returns the name of the config file used in execution. + """ + return "jedi.yaml" + @property def _driver_name(self) -> str: """ @@ -136,6 +143,22 @@ def _driver_name(self) -> str: """ return STR.jedi + @property + def _runcmd(self) -> str: + """ + Returns the full command-line component invocation. + """ + execution = self._driver_config.get("execution", {}) + jedi_config = self._rundir / self._config_fn + mpiargs = execution.get("mpiargs", []) + components = [ + execution.get("mpicmd"), # MPI run program + *[str(x) for x in mpiargs], # MPI arguments + execution["executable"], # component executable name + str(jedi_config), # JEDI config file + ] + return " ".join(filter(None, components)) + def _taskname(self, suffix: str) -> str: """ Returns a common tag for graph-task log messages. diff --git a/src/uwtools/tests/drivers/test_jedi.py b/src/uwtools/tests/drivers/test_jedi.py index a87e4d055..c307528c7 100644 --- a/src/uwtools/tests/drivers/test_jedi.py +++ b/src/uwtools/tests/drivers/test_jedi.py @@ -187,6 +187,18 @@ def test_JEDI_configuration_file(driverobj): assert newcfg == {**basecfg, "baz": "qux"} +def test_JEDI__config_fn(driverobj): + assert driverobj._config_fn == "jedi.yaml" + + +def test_JEDI__runcmd(driverobj): + executable = driverobj._driver_config["execution"]["executable"] + config = driverobj._rundir / driverobj._config_fn + assert ( + driverobj._runcmd == f"srun --export=ALL --ntasks $SLURM_CPUS_ON_NODE {executable} {config}" + ) + + def test_JEDI__runscript_path(driverobj): assert driverobj._runscript_path == driverobj._rundir / "runscript.jedi"