Skip to content

Commit

Permalink
feat(outputs): remove useless folder updated_links (#2065)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle authored Jun 17, 2024
1 parent b2f59df commit 004a3a6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
10 changes: 1 addition & 9 deletions antarest/launcher/adapters/slurm_launcher/slurm_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def _import_study_output(
xpansion_mode: t.Optional[str] = None,
log_dir: t.Optional[str] = None,
) -> t.Optional[str]:
if xpansion_mode is not None:
if xpansion_mode:
self._import_xpansion_result(job_id, xpansion_mode)

launcher_logs: t.Dict[str, t.List[Path]] = {}
Expand Down Expand Up @@ -331,14 +331,6 @@ def _import_xpansion_result(self, job_id: str, xpansion_mode: str) -> None:
)
output_path = unzipped_output_path

if (output_path / "updated_links").exists():
logger.warning("Skipping updated links")
self.callbacks.append_after_log(job_id, "Skipping updated links")
else:
shutil.copytree(
self.local_workspace / STUDIES_OUTPUT_DIR_NAME / job_id / "input" / "links",
output_path / "updated_links",
)
if xpansion_mode == "r":
shutil.copytree(
self.local_workspace / STUDIES_OUTPUT_DIR_NAME / job_id / "user" / "expansion",
Expand Down
8 changes: 0 additions & 8 deletions tests/launcher/test_slurm_launcher.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import random
import shutil
import textwrap
import uuid
from argparse import Namespace
Expand Down Expand Up @@ -400,13 +399,6 @@ def test_import_study_output(launcher_config, tmp_path) -> None:
xpansion_test_file.write_text("world")
output_dir = launcher_config.launcher.slurm.local_workspace / "OUTPUT" / "1" / "output" / "output_name"
output_dir.mkdir(parents=True)
assert not (output_dir / "updated_links" / "something").exists()
assert not (output_dir / "updated_links" / "something").exists()

slurm_launcher._import_study_output("1", "cpp")
assert (output_dir / "updated_links" / "something").exists()
assert (output_dir / "updated_links" / "something").read_text() == "hello"
shutil.rmtree(output_dir / "updated_links")

slurm_launcher._import_study_output("1", "r")
assert (output_dir / "results" / "something_else").exists()
Expand Down

0 comments on commit 004a3a6

Please sign in to comment.