Skip to content

Commit a62c940

Browse files
fstagniweb-flow
authored andcommitted
sweep: #5977 fix: allow to run Watchdog on non x86 platforms
1 parent 38a2923 commit a62c940

File tree

1 file changed

+11
-4
lines changed
  • src/DIRAC/WorkloadManagementSystem/JobWrapper

1 file changed

+11
-4
lines changed

src/DIRAC/WorkloadManagementSystem/JobWrapper/Watchdog.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -968,10 +968,17 @@ def getNodeInformation(self):
968968
result["Memory(kB)"] = int(psutil.virtual_memory()[1] / 1024)
969969
result["LocalAccount"] = getpass.getuser()
970970

971-
with open("/proc/cpuinfo", "r") as cpuinfo:
972-
info = cpuinfo.readlines()
973-
result["ModelName"] = info[4].split(":")[1].replace(" ", "").replace("\n", "")
974-
result["CacheSize(kB)"] = [x.strip().split(":")[1] for x in info if "cache size" in x][0].strip()
971+
if os.path.exists("/proc/cpuinfo"):
972+
with open("/proc/cpuinfo", "r") as cpuinfo:
973+
info = cpuinfo.readlines()
974+
try:
975+
result["ModelName"] = info[4].split(":")[1].replace(" ", "").replace("\n", "")
976+
except IndexError:
977+
pass
978+
try:
979+
result["CacheSize(kB)"] = [x.strip().split(":")[1] for x in info if "cache size" in x][0].strip()
980+
except IndexError:
981+
pass
975982

976983
return result
977984

0 commit comments

Comments
 (0)