Skip to content

Commit b597e6c

Browse files
ko3n1gclaude
andcommitted
fix(kubeflow): scope code_dir per job to avoid concurrent clobber
code_dir was scoped only per user (<pvc>/<username>/code), but package() rsyncs each job's job_dir into it. Two concurrent jobs from the same user (e.g. parallel CI test cases) therefore overwrite each other's launcher code mid-run. Scope it per job (<username>/<experiment_id>/<job_name>/code), matching how dgxcloud/lepton mirror job_dir into a per-job PVC subdir and how slurm keys packaging by experiment_id:job_name. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: oliver könig <okoenig@nvidia.com>
1 parent 3f0f5b4 commit b597e6c

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

nemo_run/core/execution/kubeflow.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,18 @@ def nnodes(self) -> int:
173173
def code_dir(self) -> str:
174174
"""Subdirectory on the PVC where user code (launch.sh, scripts) is synced.
175175
176-
Scoped to ``<workdir_pvc_path>/<username>/code`` so multiple users sharing
177-
the same PVC never clobber each other's files.
176+
Scoped to ``<workdir_pvc_path>/<username>/<experiment_id>/<job_name>/code``
177+
so that neither multiple users *nor* multiple concurrent jobs from the
178+
same user clobber each other's launcher code on a shared PVC — each
179+
``package()`` rsyncs its ``job_dir`` here, so an unscoped path lets a
180+
second job overwrite the first job's code mid-run. Falls back to a bare
181+
``<username>/code`` only before the executor is assigned to a task.
178182
"""
179-
return f"{self.workdir_pvc_path.rstrip('/')}/{getpass.getuser()}/code"
183+
parts = [
184+
p for p in (getattr(self, "experiment_id", None), getattr(self, "job_name", None)) if p
185+
]
186+
scope = "/".join([getpass.getuser(), *parts])
187+
return f"{self.workdir_pvc_path.rstrip('/')}/{scope}/code"
180188

181189
def nproc_per_node(self) -> int:
182190
"""Return processes per node: nprocs_per_node → gpus_per_node → 1."""

0 commit comments

Comments
 (0)