Skip to content

Commit

Permalink
improve the reuse default resource logic
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Sep 27, 2024
1 parent 08ce4d8 commit 97809c7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ def find_default_resource_id(workunit: Workunit) -> int | None:
candidate_resources = [
resource for resource in workunit.resources if resource["name"] not in ["slurm_stdout", "slurm_stderr"]
]
if len(candidate_resources) != 1:
return None
else:
# We also check that the resource is pending, as else we might re-use a resource that was created by the app...
if len(candidate_resources) == 1 and candidate_resources[0]["status"] == "pending":
return candidate_resources[0].id
return None


def register_all(
Expand Down

0 comments on commit 97809c7

Please sign in to comment.