diff --git a/smartsim/settings/arguments/batch/lsf.py b/smartsim/settings/arguments/batch/lsf.py index ea5747f44..9a2b1362d 100644 --- a/smartsim/settings/arguments/batch/lsf.py +++ b/smartsim/settings/arguments/batch/lsf.py @@ -190,5 +190,7 @@ def set(self, key: str, value: str | None) -> None: :param value: A string representation of the value for the launch argument (if applicable), otherwise `None` """ + if key in self._batch_args and key != self._batch_args[key]: + logger.warning(f"Overwriting argument '{key}' with value '{value}'") # Store custom arguments in the launcher_args self._batch_args[key] = value diff --git a/smartsim/settings/arguments/batch/pbs.py b/smartsim/settings/arguments/batch/pbs.py index c2affd88b..ab471c0b9 100644 --- a/smartsim/settings/arguments/batch/pbs.py +++ b/smartsim/settings/arguments/batch/pbs.py @@ -106,7 +106,9 @@ def set_walltime(self, walltime: str) -> None: if walltime and re.match(pattern, walltime): self.set("walltime", walltime) else: - raise ValueError("Invalid walltime format. Please use 'HH:MM:SS' format.") + raise ValueError( + f"Invalid walltime: {walltime}. Please use 'HH:MM:SS' format." + ) def set_queue(self, queue: str) -> None: """Set the queue for the batch job @@ -211,4 +213,6 @@ def set(self, key: str, value: str | None) -> None: :param value: A string representation of the value for the launch argument (if applicable), otherwise `None` """ + if key in self._batch_args and key != self._batch_args[key]: + logger.warning(f"Overwriting argument '{key}' with value '{value}'") self._batch_args[key] = value diff --git a/smartsim/settings/arguments/batch/slurm.py b/smartsim/settings/arguments/batch/slurm.py index 6a9d6e340..b8768ac5a 100644 --- a/smartsim/settings/arguments/batch/slurm.py +++ b/smartsim/settings/arguments/batch/slurm.py @@ -65,7 +65,9 @@ def set_walltime(self, walltime: str) -> None: if walltime and re.match(pattern, walltime): self.set("time", str(walltime)) else: - raise ValueError("Invalid walltime format. Please use 'HH:MM:SS' format.") + raise ValueError( + f"Invalid walltime: {walltime}. Please use 'HH:MM:SS' format." + ) def set_nodes(self, num_nodes: int) -> None: """Set the number of nodes for this batch job @@ -181,4 +183,6 @@ def set(self, key: str, value: str | None) -> None: argument (if applicable), otherwise `None` """ # Store custom arguments in the launcher_args + if key in self._batch_args and key != self._batch_args[key]: + logger.warning(f"Overwriting argument '{key}' with value '{value}'") self._batch_args[key] = value diff --git a/smartsim/settings/arguments/launch/alps.py b/smartsim/settings/arguments/launch/alps.py index 356a443d6..0834ae9a5 100644 --- a/smartsim/settings/arguments/launch/alps.py +++ b/smartsim/settings/arguments/launch/alps.py @@ -224,5 +224,5 @@ def set(self, key: str, value: str | None) -> None: ) return if key in self._launch_args and key != self._launch_args[key]: - logger.warning(f"Overwritting argument '{key}' with value '{value}'") + logger.warning(f"Overwriting argument '{key}' with value '{value}'") self._launch_args[key] = value diff --git a/smartsim/settings/arguments/launch/dragon.py b/smartsim/settings/arguments/launch/dragon.py index d8044267e..05de78228 100644 --- a/smartsim/settings/arguments/launch/dragon.py +++ b/smartsim/settings/arguments/launch/dragon.py @@ -71,7 +71,7 @@ def set(self, key: str, value: str | None) -> None: """ set_check_input(key, value) if key in self._launch_args and key != self._launch_args[key]: - logger.warning(f"Overwritting argument '{key}' with value '{value}'") + logger.warning(f"Overwriting argument '{key}' with value '{value}'") self._launch_args[key] = value def set_node_feature(self, feature_list: t.Union[str, t.List[str]]) -> None: diff --git a/smartsim/settings/arguments/launch/local.py b/smartsim/settings/arguments/launch/local.py index 2c589cb48..8c2224067 100644 --- a/smartsim/settings/arguments/launch/local.py +++ b/smartsim/settings/arguments/launch/local.py @@ -83,5 +83,5 @@ def set(self, key: str, value: str | None) -> None: """ set_check_input(key, value) if key in self._launch_args and key != self._launch_args[key]: - logger.warning(f"Overwritting argument '{key}' with value '{value}'") + logger.warning(f"Overwriting argument '{key}' with value '{value}'") self._launch_args[key] = value diff --git a/smartsim/settings/arguments/launch/lsf.py b/smartsim/settings/arguments/launch/lsf.py index ed2427198..9b4fe01ab 100644 --- a/smartsim/settings/arguments/launch/lsf.py +++ b/smartsim/settings/arguments/launch/lsf.py @@ -148,5 +148,5 @@ def set(self, key: str, value: str | None) -> None: ) return if key in self._launch_args and key != self._launch_args[key]: - logger.warning(f"Overwritting argument '{key}' with value '{value}'") + logger.warning(f"Overwriting argument '{key}' with value '{value}'") self._launch_args[key] = value diff --git a/smartsim/settings/arguments/launch/mpi.py b/smartsim/settings/arguments/launch/mpi.py index ce8c43aa5..090cb60dd 100644 --- a/smartsim/settings/arguments/launch/mpi.py +++ b/smartsim/settings/arguments/launch/mpi.py @@ -221,7 +221,7 @@ def set(self, key: str, value: str | None) -> None: ) return if key in self._launch_args and key != self._launch_args[key]: - logger.warning(f"Overwritting argument '{key}' with value '{value}'") + logger.warning(f"Overwriting argument '{key}' with value '{value}'") self._launch_args[key] = value diff --git a/smartsim/settings/arguments/launch/pals.py b/smartsim/settings/arguments/launch/pals.py index d48dc799b..91ae0f9aa 100644 --- a/smartsim/settings/arguments/launch/pals.py +++ b/smartsim/settings/arguments/launch/pals.py @@ -158,5 +158,5 @@ def set(self, key: str, value: str | None) -> None: ) return if key in self._launch_args and key != self._launch_args[key]: - logger.warning(f"Overwritting argument '{key}' with value '{value}'") + logger.warning(f"Overwriting argument '{key}' with value '{value}'") self._launch_args[key] = value diff --git a/smartsim/settings/arguments/launch/slurm.py b/smartsim/settings/arguments/launch/slurm.py index c5dceff62..c670b28ce 100644 --- a/smartsim/settings/arguments/launch/slurm.py +++ b/smartsim/settings/arguments/launch/slurm.py @@ -210,7 +210,9 @@ def set_walltime(self, walltime: str) -> None: if walltime and re.match(pattern, walltime): self.set("time", str(walltime)) else: - raise ValueError("Invalid walltime format. Please use 'HH:MM:SS' format.") + raise ValueError( + f"Invalid walltime: {walltime}. Please use 'HH:MM:SS' format." + ) def set_het_group(self, het_group: t.Iterable[int]) -> None: """Set the heterogeneous group for this job @@ -349,5 +351,5 @@ def set(self, key: str, value: str | None) -> None: ) return if key in self._launch_args and key != self._launch_args[key]: - logger.warning(f"Overwritting argument '{key}' with value '{value}'") + logger.warning(f"Overwriting argument '{key}' with value '{value}'") self._launch_args[key] = value diff --git a/tests/temp_tests/test_settings/test_lsfScheduler.py b/tests/temp_tests/test_settings/test_lsfScheduler.py index 81ab25c8a..038e1408e 100644 --- a/tests/temp_tests/test_settings/test_lsfScheduler.py +++ b/tests/temp_tests/test_settings/test_lsfScheduler.py @@ -77,7 +77,7 @@ def test_create_bsub(): assert args == ["-core_isolation", "-nnodes", "1", "-W", "10:10", "-q", "default"] -def test_batch_arguments_type_set_hostlist(scheduler): +def test_batch_arguments_type_set_hostlist(): bs = BatchSettings(batch_scheduler="lsf", env_vars={"ENV": "VAR"}) with pytest.raises(TypeError, match="host_list argument must be a list of strings"): bs.batch_args.set_hostlist([25, 37])