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-598 JEDI driver fix to provide a JEDI config in the run command. #505

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading