Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/DIRAC/WorkloadManagementSystem/Agent/StalledJobAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,10 @@ def _getJobPilotStatus(self, jobID):
result = getJobParameters([jobID], "Pilot_Reference")
if not result["OK"]:
return result
pilotReference = result["Value"].get("Pilot_Reference")
# getJobParameters returns {jobID: {parName: value, ...}, ...}, with jobID being either an int (JobDB)
# or a str (JobParametersDB), so look it up both ways
Comment thread
fstagni marked this conversation as resolved.
jobParameters = result["Value"].get(jobID) or result["Value"].get(str(jobID)) or {}
pilotReference = jobParameters.get("Pilot_Reference")
if not pilotReference:
# There is no pilot reference, hence its status is unknown
return S_OK("NoPilot")
Expand Down Expand Up @@ -426,14 +429,17 @@ def _sendAccounting(self, jobID):
endTime = lastHeartBeatTime

result = getJobParameters([jobID], "CPUNormalizationFactor")
if not result["OK"] or not result["Value"] or not result["Value"].get("CPUNormalizationFactor"):
self.log.error(
"Error getting Job Parameter CPUNormalizationFactor, setting 0",
result.get("Message"),
# getJobParameters returns {jobID: {parName: value, ...}, ...}, with jobID being either an int (JobDB)
# or a str (JobParametersDB), so look it up both ways
jobParameters = result.get("Value", {}).get(jobID) or result.get("Value", {}).get(str(jobID)) or {}
if not result["OK"] or not jobParameters.get("CPUNormalizationFactor"):
errorMsg = f"- {result['Message']}" if "Message" in result else "empty"
self.log.warn(
"Error getting Job Parameter CPUNormalizationFactor for", f"{jobID}: setting 0 - {errorMsg}"
)
cpuNormalization = 0.0
else:
cpuNormalization = float(result["Value"].get("CPUNormalizationFactor"))
cpuNormalization = float(jobParameters.get("CPUNormalizationFactor"))

except Exception as e:
self.log.exception(
Expand Down
Loading