From 32a2d0b861b9d78b8a9f10b4ca72fe27402cd46c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Bli=C5=BAniuk?= Date: Mon, 12 Jan 2026 13:37:28 +0100 Subject: [PATCH] fix: remove unexpected side effect in get_srun_flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, if `nemo_run_dir` is falsy, this function will append mounts to the object mounts list, resulting in unexpected extension of the list with every call. This function is called by materialize, which it turns out is even called by the `__repr__` and as such one would expect it not to have any side effects. Signed-off-by: Jakub Bliźniuk --- nemo_run/run/ray/slurm.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nemo_run/run/ray/slurm.py b/nemo_run/run/ray/slurm.py index 5fb60019..cad5e254 100644 --- a/nemo_run/run/ray/slurm.py +++ b/nemo_run/run/ray/slurm.py @@ -203,15 +203,13 @@ def get_srun_flags(mounts: list[str], container_image: Optional[str]) -> str: if gres_specification: _srun_flags.append(gres_specification) + new_mounts = copy.deepcopy(mounts) if self.nemo_run_dir: - new_mounts = copy.deepcopy(mounts) for i, mount in enumerate(new_mounts): if mount.startswith(RUNDIR_SPECIAL_NAME): new_mounts[i] = mount.replace(RUNDIR_SPECIAL_NAME, self.nemo_run_dir, 1) new_mounts.append(f"{self.nemo_run_dir}:/{RUNDIR_NAME}") - else: - new_mounts = mounts new_mounts.append(f"{self.cluster_dir}:{self.cluster_dir}") new_mounts.append(f"{logs_dir}:{logs_dir}")