Skip to content

Commit 6353986

Browse files
committed
Format
1 parent 7f38aaf commit 6353986

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

cluv/cli/init.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,15 @@ def check_ssh_hostnames(clusters: list[str]) -> None:
195195
missing_clusters = set(clusters).difference(ssh_hostnames)
196196

197197
if len(missing_clusters) > 0:
198-
console.print(f"[yellow]⚠️ Warning: Missing SSH config for {len(missing_clusters)} clusters. Try to run [bold]mila init[/bold] to add all available clusters.[/yellow]")
198+
console.print(
199+
f"[yellow]⚠️ Warning: Missing SSH config for {len(missing_clusters)} clusters. Try to run [bold]mila init[/bold] to add all available clusters.[/yellow]"
200+
)
199201
for cluster in missing_clusters:
200202
console.print(f"[yellow] - {cluster}[/yellow]")
201203
else:
202-
console.print("[green]✅ All clusters in the cluv config are present in your SSH config.[/green]")
204+
console.print(
205+
"[green]✅ All clusters in the cluv config are present in your SSH config.[/green]"
206+
)
203207

204208

205209
def check_job_script(project_root: Path, results_path: str) -> None:
@@ -224,7 +228,9 @@ def check_job_script(project_root: Path, results_path: str) -> None:
224228
for script_template in script_templates:
225229
script_path = scripts_dir / script_template.name
226230
if script_path.exists():
227-
console.print(f"[green]✅ Job template script already exists at '{script_path}'.[/green]")
231+
console.print(
232+
f"[green]✅ Job template script already exists at '{script_path}'.[/green]"
233+
)
228234
continue
229235
script_content = script_template.read_text()
230236
script_content = re.sub(
@@ -286,7 +292,9 @@ def _get_script_templates_path() -> Path:
286292
if script_templates_path.exists():
287293
return script_templates_path
288294
checked_paths_text = ", ".join(str(path) for path in checked_paths)
289-
raise RuntimeError(f"Couldn't find the script templates folder. Checked: {checked_paths_text}.")
295+
raise RuntimeError(
296+
f"Couldn't find the script templates folder. Checked: {checked_paths_text}."
297+
)
290298

291299

292300
def _get_pyproject_template_path() -> Path:

tests/test_init.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@ def test_add_missing_cluv_config(self, tmp_path: Path) -> None:
6565
def test_keep_existing_cluv_config(self, tmp_path: Path) -> None:
6666
"""check_cluv_config() should not overwrite an existing cluv config"""
6767
p = tmp_path / "pyproject.toml"
68-
p.write_text(textwrap.dedent(
69-
"""\
68+
p.write_text(
69+
textwrap.dedent(
70+
"""\
7071
[tool.cluv]
7172
clusters = {"mila" = {}}
7273
results_path = "results"
7374
"""
74-
))
75+
)
76+
)
7577

7678
check_cluv_config(p)
7779
config = load_cluv_config(p)
@@ -193,7 +195,7 @@ def test_replace_results_dir_from_legacy_template(
193195
generated_legacy_script = project_root / "scripts" / "legacy_job.sh"
194196
assert generated_legacy_script.exists()
195197
generated_legacy_script_content = generated_legacy_script.read_text()
196-
assert '#SBATCH --output=outputs/%j/slurm-%j.out' in generated_legacy_script_content
198+
assert "#SBATCH --output=outputs/%j/slurm-%j.out" in generated_legacy_script_content
197199
assert 'results_path="outputs"' in generated_legacy_script_content
198200
assert "Using $results_path" in generated_legacy_script_content
199201
assert "results_dir" not in generated_legacy_script_content

0 commit comments

Comments
 (0)