Skip to content

Commit

Permalink
Merge pull request #7850 from DIRACGridBot/cherry-pick-2-4c0a23dc0-in…
Browse files Browse the repository at this point in the history
…tegration

[sweep:integration] Fix deadlock when FTS3Agent._treatOperation fails
  • Loading branch information
fstagni authored Nov 6, 2024
2 parents 29ff35e + 78f6d8a commit 5c590aa
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/DIRAC/DataManagementSystem/Agent/FTS3Agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,15 @@ def _monitorJobCallback(returnedValue):
:param returnedValue: value returned by the _monitorJob method
(ftsJob, standard dirac return struct)
"""

ftsJob, res = returnedValue
log = gLogger.getLocalSubLogger(f"_monitorJobCallback/{ftsJob.jobID}")
if not res["OK"]:
log.error("Error updating job status", res)
if not isinstance(returnedValue, tuple) or len(returnedValue) != 2:
ftsJob, res = returnedValue
log = gLogger.getLocalSubLogger(f"_monitorJobCallback/{ftsJob.jobID}")
if not res["OK"]:
log.error("Error updating job status", res)
else:
log.debug("Successfully updated job status")
else:
log.debug("Successfully updated job status")
log.error("Invalid return value when monitoring job", f"{returnedValue!r}")

def monitorJobsLoop(self):
"""* fetch the active FTSJobs from the DB
Expand Down Expand Up @@ -375,13 +377,15 @@ def _treatOperationCallback(returnedValue):
:param returnedValue: value returned by the _treatOperation method
(ftsOperation, standard dirac return struct)
"""

operation, res = returnedValue
log = gLogger.getLocalSubLogger(f"_treatOperationCallback/{operation.operationID}")
if not res["OK"]:
log.error("Error treating operation", res)
if isinstance(returnedValue, tuple) and len(returnedValue) == 2:
operation, res = returnedValue
log = gLogger.getLocalSubLogger(f"_treatOperationCallback/{operation.operationID}")
if not res["OK"]:
log.error("Error treating operation", res)
else:
log.debug("Successfully treated operation")
else:
log.debug("Successfully treated operation")
log.error("Invalid return value when treating operation", f"{returnedValue!r}")

def _treatOperation(self, operation):
"""Treat one operation:
Expand Down Expand Up @@ -513,7 +517,7 @@ def _treatOperation(self, operation):
scope=["fts"],
)
if not res["OK"]:
return res
return operation, res

fts_access_token = res["Value"]["access_token"]

Expand Down

0 comments on commit 5c590aa

Please sign in to comment.