Skip to content

Commit

Permalink
fix behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
francesconazzaro committed Aug 8, 2024
1 parent 33c7ac2 commit 7fa7cc8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions cads_broker/dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,23 +336,21 @@ def manage_dismissed_request(self, request, session):
session=session,
)
previous_status = dismission_metadata.get("previous_status", "accepted")
if dismission_metadata.get("reason", "DismissedRequest") == "PermissionError":
request.status = "failed"
request.finished_at = datetime.datetime.now()
else:
request.status = "deleted"
if previous_status == "running":
self.qos.notify_end_of_request(
request, session, scheduler=self.internal_scheduler
)
request.status = "deleted"
elif previous_status == "accepted":
self.queue.pop(request.request_uid, None)
self.qos.notify_dismission_of_request(
request, session, scheduler=self.internal_scheduler
)
if (
reason := dismission_metadata.get("reason", "DismissedRequest")
) == "DismissedRequest":
request.status = "deleted"
elif reason == "PermissionError":
request.status = "failed"
request.finished_at = datetime.datetime.now()
logger.info("job has finished", **db.logger_kwargs(request=request))
return session

@cachetools.cachedmethod(lambda self: self.ttl_cache)
Expand Down
2 changes: 1 addition & 1 deletion cads_broker/entry_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def delete_requests(
status="dismissed",
request_metadata={
"dismission": {
"reason": "DismissedRequest",
"reason": "PermissionError",
"message": message,
"previous_status": status,
}
Expand Down

0 comments on commit 7fa7cc8

Please sign in to comment.