Skip to content

Commit e65ccbb

Browse files
committed
fix: Fixing discrepancies between Accounting and Monitoring
1 parent d9dd4c7 commit e65ccbb

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

src/DIRAC/MonitoringSystem/Client/MonitoringReporter.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def __init__(self, monitoringType="", failoverQueueName="dirac.monitoring"):
4949
self.__monitoringType = monitoringType
5050
self.__failoverQueueName = failoverQueueName
5151
self.__defaultMQProducer = None
52+
self.__commitTimer = threading.Timer(5, self.commit)
5253

5354
def __del__(self):
5455
if self.__defaultMQProducer is not None:
@@ -164,6 +165,18 @@ def commit(self):
164165
self.__documentLock.release()
165166
return S_OK(recordSent)
166167

168+
def delayedCommit(self):
169+
"""
170+
If needed start a timer that will run the commit later
171+
allowing to send more registers at once (reduces overheads).
172+
"""
173+
174+
if not self.__commitTimer.is_alive():
175+
self.__commitTimer = threading.Timer(5, self.commit)
176+
self.__commitTimer.start()
177+
178+
return S_OK()
179+
167180
def __getProducer(self):
168181
"""
169182
This method is used to get the default MQ producer or create it if needed.

src/DIRAC/MonitoringSystem/Client/Types/PilotSubmissionMonitoring.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ def __init__(self):
3636
}
3737
)
3838

39-
self.dataToKeep = 86400 * 30
39+
self.dataToKeep = 86400 * 30 * 14
4040

4141
self.checkType()

src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,18 +1414,18 @@ def sendPilotSubmissionMonitoring(self, siteName, ceName, queueName, numTotal, n
14141414
"SiteDirector": siteDirName,
14151415
"Site": siteName,
14161416
"CE": ceName,
1417-
"Queue": queueName,
1417+
"Queue": ceName + ":" + queueName,
14181418
"Status": status,
14191419
"NumTotal": numTotal,
14201420
"NumSucceded": numSucceeded,
14211421
"timestamp": int(toEpoch(dateTime())),
14221422
}
14231423
pilotMonitoringReporter.addRecord(pilotMonitoringData)
1424-
result = pilotMonitoringReporter.commit()
14251424

14261425
self.log.verbose("Committing pilot submission to monitoring")
1426+
result = pilotMonitoringReporter.delayedCommit()
14271427
if not result["OK"]:
1428-
self.log.error("Couldn't commit pilot submission to monitoring", result["Message"])
1428+
self.log.error("Could not commit pilot submission to monitoring", result["Message"])
14291429
return S_ERROR()
14301430
self.log.verbose("Done committing to monitoring")
14311431
return S_OK()

0 commit comments

Comments
 (0)