Skip to content

Commit 77ccca1

Browse files
authored
Merge pull request #8020 from fstagni/cherry-pick-2-8a0f1f88d-integration
[sweep:integration] StalledJobAgent: if StartExecTime is not set, use the last recorded heartbeat
2 parents 0fffb75 + cad4ff1 commit 77ccca1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/DIRAC/WorkloadManagementSystem/Agent/StalledJobAgent.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -453,14 +453,12 @@ def _sendAccounting(self, jobID):
453453
return result
454454

455455
def _checkHeartBeat(self, jobID, jobDict):
456-
"""Get info from HeartBeat."""
457-
result = self.jobDB.getHeartBeatData(jobID)
456+
"""Get info from HeartBeat"""
458457
lastCPUTime = 0
459458
lastWallTime = 0
460-
lastHeartBeatTime = jobDict["StartExecTime"]
461-
if lastHeartBeatTime == "None":
462-
lastHeartBeatTime = 0
459+
lastHeartBeatTime = jobDict.get("StartExecTime")
463460

461+
result = self.jobDB.getHeartBeatData(jobID)
464462
if result["OK"]:
465463
for name, value, heartBeatTime in result["Value"]:
466464
if name == "CPUConsumed":
@@ -479,7 +477,8 @@ def _checkHeartBeat(self, jobID, jobDict):
479477
pass
480478
if isinstance(heartBeatTime, str):
481479
heartBeatTime = datetime.datetime.strptime(heartBeatTime, "%Y-%m-%d %H:%M:%S")
482-
if heartBeatTime > lastHeartBeatTime:
480+
481+
if not lastHeartBeatTime or lastHeartBeatTime == "None" or heartBeatTime > lastHeartBeatTime:
483482
lastHeartBeatTime = heartBeatTime
484483

485484
return lastCPUTime, lastWallTime, lastHeartBeatTime

0 commit comments

Comments
 (0)