From 4cebaf5f31902950358fb11c190bfdbe23835e26 Mon Sep 17 00:00:00 2001 From: "Christina.Holt" Date: Wed, 30 Jul 2025 17:18:20 +0000 Subject: [PATCH] Make mpassit run cmd mpi-compatible. --- src/uwtools/drivers/mpassit.py | 11 +++++++++-- src/uwtools/tests/drivers/test_mpassit.py | 2 +- src/uwtools/tests/test_schemas.py | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/uwtools/drivers/mpassit.py b/src/uwtools/drivers/mpassit.py index f4df401b0..70e5d3f08 100644 --- a/src/uwtools/drivers/mpassit.py +++ b/src/uwtools/drivers/mpassit.py @@ -114,5 +114,12 @@ def _runcmd(self) -> str: """ The full command-line component invocation. """ - executable = self.config[STR.execution][STR.executable] - return "%s %s" % (executable, self._input_config_path.name) + execution = self.config.get(STR.execution, {}) + mpiargs = execution.get(STR.mpiargs, []) + components = [ + execution.get(STR.mpicmd), # MPI run program + *[str(x) for x in mpiargs], # MPI arguments + execution[STR.executable], # component executable name + self._input_config_path.name, # namelist name + ] + return " ".join(filter(None, components)) diff --git a/src/uwtools/tests/drivers/test_mpassit.py b/src/uwtools/tests/drivers/test_mpassit.py index 0274ac57f..d76043c08 100644 --- a/src/uwtools/tests/drivers/test_mpassit.py +++ b/src/uwtools/tests/drivers/test_mpassit.py @@ -100,4 +100,4 @@ def test_MPASSIT__input_config_path(driverobj, tmp_path): def test_MPASSIT__runcmd(driverobj): - assert driverobj._runcmd == "/path/to/mpassit mpassit.nml" + assert driverobj._runcmd == "srun /path/to/mpassit mpassit.nml" diff --git a/src/uwtools/tests/test_schemas.py b/src/uwtools/tests/test_schemas.py index 70bf5e3b3..3f005012a 100644 --- a/src/uwtools/tests/test_schemas.py +++ b/src/uwtools/tests/test_schemas.py @@ -276,6 +276,7 @@ def mpas_streams(): MPASSIT_CONFIG = { "execution": { "executable": "/path/to/mpassit", + "mpicmd": "srun", }, "namelist": { "update_values": {