diff --git a/src/DIRAC/WorkloadManagementSystem/DB/JobDB.py b/src/DIRAC/WorkloadManagementSystem/DB/JobDB.py index c98bea92b33..fcdda3b2124 100755 --- a/src/DIRAC/WorkloadManagementSystem/DB/JobDB.py +++ b/src/DIRAC/WorkloadManagementSystem/DB/JobDB.py @@ -195,7 +195,11 @@ def getJobParameters(self, jobID, paramList=None): if result["OK"]: if result["Value"]: for res_jobID, res_name, res_value in result["Value"]: - resultDict.setdefault(int(res_jobID), {})[res_name] = res_value.decode(errors="replace") + try: + res_value = res_value.decode(errors="replace") # account for use of BLOBs + except AttributeError: + pass + resultDict.setdefault(int(res_jobID), {})[res_name] = res_value return S_OK(resultDict) # there's a slim chance that this is an empty dictionary else: @@ -207,7 +211,11 @@ def getJobParameters(self, jobID, paramList=None): return result for res_jobID, res_name, res_value in result["Value"]: - resultDict.setdefault(int(res_jobID), {})[res_name] = res_value.decode(errors="replace") + try: + res_value = res_value.decode(errors="replace") # account for use of BLOBs + except AttributeError: + pass + resultDict.setdefault(int(res_jobID), {})[res_name] = res_value return S_OK(resultDict) # there's a slim chance that this is an empty dictionary @@ -246,7 +254,11 @@ def getAtticJobParameters(self, jobID, paramList=None, rescheduleCounter=-1): if result["OK"]: if result["Value"]: for name, value, counter in result["Value"]: - resultDict.setdefault(counter, {})[name] = value.decode() + try: + value = value.decode() # account for use of BLOBs + except AttributeError: + pass + resultDict.setdefault(counter, {})[name] = value return S_OK(resultDict) else: @@ -397,7 +409,11 @@ def getJobOptParameters(self, jobID, paramList=None): result = self._query(cmd) if not result["OK"]: return S_ERROR("JobDB.getJobOptParameters: failed to retrieve parameters") - return S_OK({name: value.decode() for name, value in result.get("Value", {})}) + try: + jobOptParameters = {name: value.decode() for name, value in result.get("Value", {})} # account for BLOBs + except AttributeError: + jobOptParameters = {name: value for name, value in result.get("Value", {})} + return S_OK(jobOptParameters) ############################################################################# diff --git a/src/DIRAC/WorkloadManagementSystem/DB/PilotAgentsDB.py b/src/DIRAC/WorkloadManagementSystem/DB/PilotAgentsDB.py index 243ae47144a..bbce720f48b 100755 --- a/src/DIRAC/WorkloadManagementSystem/DB/PilotAgentsDB.py +++ b/src/DIRAC/WorkloadManagementSystem/DB/PilotAgentsDB.py @@ -418,8 +418,12 @@ def getPilotOutput(self, pilotRef): return result else: if result["Value"]: - stdout = result["Value"][0][0] - error = result["Value"][0][1] + try: + stdout = result["Value"][0][0].decode() # account for the use of BLOBs + error = result["Value"][0][1].decode() + except AttributeError: + stdout = result["Value"][0][0] + error = result["Value"][0][1] if stdout == '""': stdout = "" if error == '""':