Skip to content

Commit

Permalink
spelling update, minor test changes
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaputko committed Oct 31, 2024
1 parent e9d6ed8 commit acd56da
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 11 deletions.
2 changes: 2 additions & 0 deletions smartsim/settings/arguments/batch/lsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion smartsim/settings/arguments/batch/pbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
6 changes: 5 additions & 1 deletion smartsim/settings/arguments/batch/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion smartsim/settings/arguments/launch/alps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion smartsim/settings/arguments/launch/dragon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}'")

Check warning on line 74 in smartsim/settings/arguments/launch/dragon.py

View check run for this annotation

Codecov / codecov/patch

smartsim/settings/arguments/launch/dragon.py#L74

Added line #L74 was not covered by tests
self._launch_args[key] = value

def set_node_feature(self, feature_list: t.Union[str, t.List[str]]) -> None:
Expand Down
2 changes: 1 addition & 1 deletion smartsim/settings/arguments/launch/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}'")

Check warning on line 86 in smartsim/settings/arguments/launch/local.py

View check run for this annotation

Codecov / codecov/patch

smartsim/settings/arguments/launch/local.py#L86

Added line #L86 was not covered by tests
self._launch_args[key] = value
2 changes: 1 addition & 1 deletion smartsim/settings/arguments/launch/lsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion smartsim/settings/arguments/launch/mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}'")

Check warning on line 224 in smartsim/settings/arguments/launch/mpi.py

View check run for this annotation

Codecov / codecov/patch

smartsim/settings/arguments/launch/mpi.py#L224

Added line #L224 was not covered by tests
self._launch_args[key] = value


Expand Down
2 changes: 1 addition & 1 deletion smartsim/settings/arguments/launch/pals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions smartsim/settings/arguments/launch/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion tests/temp_tests/test_settings/test_lsfScheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit acd56da

Please sign in to comment.