Skip to content

Commit

Permalink
Provide a config to the jedi executable.
Browse files Browse the repository at this point in the history
  • Loading branch information
christinaholtNOAA committed Jun 9, 2024
1 parent 6e1eff5 commit f6beef7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/uwtools/drivers/jedi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -129,13 +129,36 @@ 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:
"""
Returns the name of this driver.
"""
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.
Expand Down
12 changes: 12 additions & 0 deletions src/uwtools/tests/drivers/test_jedi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit f6beef7

Please sign in to comment.