Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 3 additions & 3 deletions src/cloudai/systems/slurm/slurm_command_gen_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,10 @@ def _append_sbatch_directives(self, batch_script_content: List[str]) -> None:
def _append_nodes_related_directives(self, content: List[str]) -> Optional[Path]:
num_nodes, node_list = self.get_cached_nodes_spec()

if self.system.distribution:
content.append(f"#SBATCH --distribution={self.system.distribution}")

if node_list:
content.append("#SBATCH --distribution=arbitrary")
content.append(f"#SBATCH --nodelist={','.join(node_list)}")

hostfile = (self.test_run.output_path / "hostfile.txt").absolute()
Expand All @@ -417,8 +419,6 @@ def _append_nodes_related_directives(self, content: List[str]) -> Optional[Path]
return hostfile

content.append(f"#SBATCH -N {num_nodes}")
if self.system.distribution:
content.append(f"#SBATCH --distribution={self.system.distribution}")

return None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def test_append_distribution_and_hostfile_with_nodes(slurm_system: SlurmSystem,
content: List[str] = []
strategy._append_nodes_related_directives(content)

assert "#SBATCH --distribution=arbitrary" in content
assert "#SBATCH --distribution=block" in content
assert "#SBATCH --nodelist=node1,node2" in content

hostfile_path = strategy.test_run.output_path / "hostfile.txt"
Expand Down
Loading