Skip to content

Commit

Permalink
feat: add more SD tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aldbr committed Sep 22, 2023
1 parent 9e0c9a4 commit 5c87e00
Show file tree
Hide file tree
Showing 14 changed files with 499 additions and 369 deletions.
6 changes: 5 additions & 1 deletion src/DIRAC/Resources/Computing/AREXComputingElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,11 @@ def getCEStatus(self):
self.log.error("Failed getting the status of the CE.", result["Message"])
return S_ERROR("Failed getting the status of the CE")
response = result["Value"]
ceData = response.json()
try:
ceData = response.json()
except requests.JSONDecodeError:
self.log.exception("Failed decoding the status of the CE")
return S_ERROR(f"Failed decoding the status of the CE")

# Look only in the relevant section out of the headache
queueInfo = ceData["Domains"]["AdminDomain"]["Services"]["ComputingService"]["ComputingShare"]
Expand Down
8 changes: 2 additions & 6 deletions src/DIRAC/Resources/Computing/CloudComputingElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def _getMetadata(self, executableFile, pilotStamp=""):
template = yaml.safe_load(template_fd)
for filedef in template["write_files"]:
if filedef["content"] == "PROXY_STR":
filedef["content"] = self.proxy
filedef["content"] = self.proxy.dumpAllToString()["Value"]
elif filedef["content"] == "EXECUTABLE_STR":
filedef["content"] = exe_str
elif "STAMP_STR" in filedef["content"]:
Expand Down Expand Up @@ -383,11 +383,7 @@ def _renewCloudProxy(self):
if not res["OK"]:
self.log.error("Could not download proxy", res["Message"])
return False
resdump = res["Value"].dumpAllToString()
if not resdump["OK"]:
self.log.error("Failed to dump proxy to string", resdump["Message"])
return False
self.proxy = resdump["Value"]
self.proxy = res["Value"]
self.valid = datetime.datetime.utcnow() + proxyLifetime * datetime.timedelta(seconds=1)
return True

Expand Down
3 changes: 1 addition & 2 deletions src/DIRAC/Resources/Computing/ComputingElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def available(self):
self.log.verbose("Max Number of Jobs:", maxTotalJobs)
self.log.verbose("Max Waiting Jobs:", maxWaitingJobs)

result["CEInfoDict"] = ceInfoDict
# If we reached the maximum number of total jobs, then the CE is not available
totalJobs = runningJobs + waitingJobs
if totalJobs >= maxTotalJobs:
Expand All @@ -283,8 +284,6 @@ def available(self):
if availableProcessors is not None:
additionalJobs = min(additionalJobs, availableProcessors)
result["Value"] = additionalJobs

result["CEInfoDict"] = ceInfoDict
return result

#############################################################################
Expand Down
Loading

0 comments on commit 5c87e00

Please sign in to comment.