From 19d50d6b95da2358bc2800d08223bbcbb5b6d5a8 Mon Sep 17 00:00:00 2001 From: Todor Ivanov Date: Wed, 7 Dec 2022 10:07:26 +0100 Subject: [PATCH] Add try/except block for fetching PartialCopy parameter from camapign configuration. --- .../WMCore/MicroService/MSMonitor/MSMonitor.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/python/WMCore/MicroService/MSMonitor/MSMonitor.py b/src/python/WMCore/MicroService/MSMonitor/MSMonitor.py index e3268ad953..c9818930a7 100644 --- a/src/python/WMCore/MicroService/MSMonitor/MSMonitor.py +++ b/src/python/WMCore/MicroService/MSMonitor/MSMonitor.py @@ -230,9 +230,18 @@ def getCompletedWorkflows(self, transfers, campaigns): # check completion of all transfers statuses = [] for transfer in record['transfers']: - cdict = campaigns[transfer['campaignName']] + try: + cdict = campaigns[transfer['campaignName']] + partialCopy = cdict['PartialCopy'] + except Exception as ex: + # Just log the error and stop checking any further transfers for the current request. + status = 0 + statuses.append(status) + msg = "Missing or broken campaign configuration at ReqMgr for request: %s. Error: %s" + self.logger.exception(msg, reqName, str(ex)) + break # compare against the last completion number, which is from the last cycle execution - if transfer['completion'][-1] >= cdict['PartialCopy'] * 100: + if transfer['completion'][-1] >= partialCopy * 100: status = 1 else: status = 0