Skip to content

Commit

Permalink
Merge pull request #63 from CederGroupHub/62-bug-permissionerror-curr…
Browse files Browse the repository at this point in the history
…ently-the-device-arm_characterization-is-not-occupied-which-is-currently-in-status-idle-136

62 bug permissionerror currently the device arm characterization is not occupied which is currently in status idle 136
  • Loading branch information
odartsi authored Apr 16, 2024
2 parents 6af9893 + 071e8ec commit 81c81e0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions alab_management/task_manager/resource_requester.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@ def release_resources(self, request_id: ObjectId) -> bool:
},
)

# wait for the request to be released
while (self.get_request(request_id, projection=["status"]))[
"status"
] == RequestStatus.NEED_RELEASE.name:
time.sleep(0.5)

return result.modified_count == 1

def release_all_resources(self):
Expand Down Expand Up @@ -273,6 +279,9 @@ def release_all_resources(self):
}
},
)
# wait for all the requests to be released
while any(request["status"] == RequestStatus.NEED_RELEASE.name for request in self.get_requests_by_task_id(self.task_id)):
time.sleep(0.5)

def _check_request_status_loop(self):
while not self._stop:
Expand Down

0 comments on commit 81c81e0

Please sign in to comment.