Skip to content

Commit

Permalink
Ensure that bundle exists in a project before yielding cluster jobs f…
Browse files Browse the repository at this point in the history
…rom it (#832)
  • Loading branch information
bdice committed Mar 21, 2024
1 parent 525ec4c commit ac6a5ac
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions flow/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -2203,9 +2203,16 @@ def _expand_bundled_jobs(self, scheduler_jobs):
bundle_prefix = self._bundle_prefix
for job in scheduler_jobs:
if job.name().startswith(bundle_prefix):
with open(self._fn_bundle(job.name())) as file:
for line in file:
yield ClusterJob(line.strip(), job.status())
bundle_name = self._fn_bundle(job.name())
# Ensure that the bundle exists in this project before yielding
# jobs from it. This check is necessary because scheduler jobs
# with the same prefix could exist, submitted by other
# FlowProjects with the same name from this user or other
# users. See https://github.com/glotzerlab/signac-flow/issues/758
if os.path.exists(bundle_name):
with open(bundle_name) as file:
for line in file:
yield ClusterJob(line.strip(), job.status())
else:
yield job

Expand Down

0 comments on commit ac6a5ac

Please sign in to comment.