Skip to content

Commit 7c2f47f

Browse files
authored
Merge pull request #7013 from DIRACGridBot/cherry-pick-2-ed24123d8-integration
[sweep:integration] Fix RMS monitoring with no object IDs
2 parents 9069df0 + d9ccdef commit 7c2f47f

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

src/DIRAC/RequestManagementSystem/private/OperationHandlerBase.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def createRMSRecord(self, status, nbObject):
282282
"operationType": self.operation.Type,
283283
"status": status,
284284
"nbObject": nbObject,
285-
"parentID": self.operation.OperationID,
285+
"parentID": getattr(self.operation, "OperationID", 0),
286286
}
287287

288288
return record

src/DIRAC/RequestManagementSystem/private/RequestTask.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@ def __call__(self):
291291
"host": Network.getFQDN(),
292292
"objectType": "Operation",
293293
"operationType": pluginName,
294-
"objectID": operation.OperationID,
295-
"parentID": operation.RequestID,
294+
"objectID": getattr(operation, "OperationID", 0),
295+
"parentID": getattr(operation, "RequestID", 0),
296296
"status": "Attempted",
297297
"nbObject": 1,
298298
}
@@ -313,8 +313,8 @@ def __call__(self):
313313
"host": Network.getFQDN(),
314314
"objectType": "Operation",
315315
"operationType": pluginName,
316-
"objectID": operation.OperationID,
317-
"parentID": operation.RequestID,
316+
"objectID": getattr(operation, "OperationID", 0),
317+
"parentID": getattr(operation, "RequestID", 0),
318318
"status": "Failed",
319319
"nbObject": 1,
320320
}
@@ -325,7 +325,7 @@ def __call__(self):
325325
"timestamp": int(TimeUtilities.toEpochMilliSeconds()),
326326
"host": Network.getFQDN(),
327327
"objectType": "Request",
328-
"objectID": operation.RequestID,
328+
"objectID": getattr(operation, "RequestID", 0),
329329
"status": "Failed",
330330
"nbObject": 1,
331331
}
@@ -347,7 +347,10 @@ def __call__(self):
347347
if operation.Status != "Failed":
348348
operation.Status = "Failed"
349349
self.request.Error = "Job no longer exists"
350-
except Exception as error:
350+
except Exception as e:
351+
# We can't do except Exception as error
352+
# because it masks the local variable
353+
error = repr(e)
351354
self.log.exception("hit by exception:", error)
352355
if pluginName:
353356
if self.rmsMonitoring:
@@ -357,8 +360,8 @@ def __call__(self):
357360
"host": Network.getFQDN(),
358361
"objectType": "Operation",
359362
"operationType": pluginName,
360-
"objectID": operation.OperationID,
361-
"parentID": operation.RequestID,
363+
"objectID": getattr(operation, "OperationID", 0),
364+
"parentID": getattr(operation, "RequestID", 0),
362365
"status": "Failed",
363366
"nbObject": 1,
364367
}
@@ -369,7 +372,7 @@ def __call__(self):
369372
"timestamp": int(TimeUtilities.toEpochMilliSeconds()),
370373
"host": Network.getFQDN(),
371374
"objectType": "Request",
372-
"objectID": operation.RequestID,
375+
"objectID": getattr(operation, "RequestID", 0),
373376
"status": "Failed",
374377
"nbObject": 1,
375378
}
@@ -388,8 +391,8 @@ def __call__(self):
388391
"host": Network.getFQDN(),
389392
"objectType": "Operation",
390393
"operationType": pluginName,
391-
"objectID": operation.OperationID,
392-
"parentID": operation.RequestID,
394+
"objectID": getattr(operation, "OperationID", 0),
395+
"parentID": getattr(operation, "RequestID", 0),
393396
"status": "Successful",
394397
"nbObject": 1,
395398
}
@@ -402,8 +405,8 @@ def __call__(self):
402405
"host": Network.getFQDN(),
403406
"objectType": "Operation",
404407
"operationType": pluginName,
405-
"objectID": operation.OperationID,
406-
"parentID": operation.RequestID,
408+
"objectID": getattr(operation, "OperationID", 0),
409+
"parentID": getattr(operation, "RequestID", 0),
407410
"status": "Failed",
408411
"nbObject": 1,
409412
}

0 commit comments

Comments
 (0)