Skip to content

Commit d9d237b

Browse files
chrisburrweb-flow
authored andcommitted
sweep: #7089 Fix exceptions in StalledJobAgent
1 parent 31c8694 commit d9d237b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/DIRAC/WorkloadManagementSystem/Agent/StalledJobAgent.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def _updateJobStatus(self, job, status, minorStatus=None, force=False):
340340

341341
if not minorStatus: # Retain last minor status for stalled jobs
342342
result = self.jobDB.getJobAttributes(job, ["MinorStatus"])
343-
if result["OK"]:
343+
if result["OK"] and "MinorStatus" in result["Value"]:
344344
minorStatus = result["Value"]["MinorStatus"]
345345
else:
346346
self.log.error("Failed getting MinorStatus", "for job %d: %s" % (job, result["Message"]))
@@ -475,6 +475,8 @@ def _checkHeartBeat(self, jobID, jobDict):
475475
lastWallTime = value
476476
except ValueError:
477477
pass
478+
if isinstance(heartBeatTime, str):
479+
heartBeatTime = datetime.datetime.strptime(heartBeatTime, "%Y-%m-%d %H:%M:%S")
478480
if heartBeatTime > lastHeartBeatTime:
479481
lastHeartBeatTime = heartBeatTime
480482

0 commit comments

Comments
 (0)