Skip to content

Commit 6a8dc92

Browse files
committed
fix: Removing gMonitor from more files
1 parent 3cab0b9 commit 6a8dc92

File tree

13 files changed

+1
-1994
lines changed

13 files changed

+1
-1994
lines changed

src/DIRAC/AccountingSystem/DB/AccountingDB.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from DIRAC.Core.Base.DB import DB
99
from DIRAC import S_OK, S_ERROR, gConfig
10-
from DIRAC.FrameworkSystem.Client.MonitoringClient import gMonitor
1110
from DIRAC.Core.Utilities import List, ThreadSafe, Time, DEncode
1211
from DIRAC.Core.Utilities.Plotting.TypeLoader import TypeLoader
1312
from DIRAC.Core.Utilities.ThreadPool import ThreadPool
@@ -48,9 +47,6 @@ def __init__(self, name="Accounting/AccountingDB", readOnly=False):
4847
}
4948
)
5049
self.__loadCatalogFromDB()
51-
gMonitor.registerActivity("registeradded", "Register added", "Accounting", "entries", gMonitor.OP_ACUM)
52-
gMonitor.registerActivity("insertiontime", "Record insertion time", "Accounting", "seconds", gMonitor.OP_MEAN)
53-
gMonitor.registerActivity("querytime", "Records query time", "Accounting", "seconds", gMonitor.OP_MEAN)
5450

5551
self.__compactTime = datetime.time(hour=2, minute=random.randint(0, 59), second=random.randint(0, 59))
5652
lcd = Time.dateTime()
@@ -281,20 +277,6 @@ def registerType(self, name, definitionKeyFields, definitionAccountingFields, bu
281277
"""
282278
Register a new type
283279
"""
284-
gMonitor.registerActivity(
285-
"registerwaiting:%s" % name,
286-
"Records waiting for insertion for %s" % " ".join(name.split("_")),
287-
"Accounting",
288-
"records",
289-
gMonitor.OP_MEAN,
290-
)
291-
gMonitor.registerActivity(
292-
"registeradded:%s" % name,
293-
"Register added for %s" % " ".join(name.split("_")),
294-
"Accounting",
295-
"entries",
296-
gMonitor.OP_ACUM,
297-
)
298280

299281
result = self.__loadTablesCreated()
300282
if not result["OK"]:
@@ -628,16 +610,13 @@ def __insertFromINTable(self, recordTuples):
628610
result = self._update("DELETE FROM `%s` WHERE id=%s" % (_getTableName("in", typeName), iD))
629611
if not result["OK"]:
630612
self.log.error("Can't delete row from the IN table", result["Message"])
631-
gMonitor.addMark("insertiontime", Time.toEpoch() - insertionEpoch)
632613

633614
def insertRecordDirectly(self, typeName, startTime, endTime, valuesList):
634615
"""
635616
Add an entry to the type contents
636617
"""
637618
if self.__readOnly:
638619
return S_ERROR("ReadOnly mode enabled. No modification allowed")
639-
gMonitor.addMark("registeradded", 1)
640-
gMonitor.addMark("registeradded:%s" % typeName, 1)
641620
self.log.info(
642621
"Adding record", "for type %s\n [%s -> %s]" % (typeName, Time.fromEpoch(startTime), Time.fromEpoch(endTime))
643622
)
@@ -977,7 +956,6 @@ def retrieveBucketedData(
977956
result = self.__queryType(
978957
typeName, startTime, endTime, selectFields, condDict, groupFields, orderFields, "bucket", connObj=connObj
979958
)
980-
gMonitor.addMark("querytime", Time.toEpoch() - startQueryEpoch)
981959
return result
982960

983961
def __queryType(

src/DIRAC/AccountingSystem/Service/ReportGeneratorHandler.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from DIRAC import S_OK, S_ERROR, rootPath, gConfig, gLogger
1313
from DIRAC.Core.Utilities.File import mkDir
1414
from DIRAC.Core.Utilities import Time
15-
from DIRAC.FrameworkSystem.Client.MonitoringClient import gMonitor
1615
from DIRAC.AccountingSystem.DB.MultiAccountingDB import MultiAccountingDB
1716
from DIRAC.Core.Utilities.Plotting import gDataCache
1817
from DIRAC.AccountingSystem.private.MainReporter import MainReporter
@@ -59,10 +58,6 @@ def initializeHandler(cls, serviceInfo):
5958
gLogger.fatal("Can't write to %s" % dataPath)
6059
return S_ERROR("Data location is not writable")
6160
gDataCache.setGraphsLocation(dataPath)
62-
gMonitor.registerActivity("plotsDrawn", "Drawn plot images", "Accounting reports", "plots", gMonitor.OP_SUM)
63-
gMonitor.registerActivity(
64-
"reportsRequested", "Generated reports", "Accounting reports", "reports", gMonitor.OP_SUM
65-
)
6661
return S_OK()
6762

6863
def __checkPlotRequest(self, reportRequest):
@@ -121,7 +116,6 @@ def export_generatePlot(self, reportRequest):
121116
if not retVal["OK"]:
122117
return retVal
123118
reporter = MainReporter(self.__acDB, self.serviceInfoDict["clientSetup"])
124-
gMonitor.addMark("plotsDrawn")
125119
reportRequest["generatePlot"] = True
126120
return reporter.generate(reportRequest, self.getRemoteCredentials())
127121

@@ -143,7 +137,6 @@ def export_getReport(self, reportRequest):
143137
if not retVal["OK"]:
144138
return retVal
145139
reporter = MainReporter(self.__acDB, self.serviceInfoDict["clientSetup"])
146-
gMonitor.addMark("reportsRequested")
147140
reportRequest["generatePlot"] = False
148141
return reporter.generate(reportRequest, self.getRemoteCredentials())
149142

src/DIRAC/Core/Base/AgentModule.py

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
from DIRAC.Core.Utilities.Shifter import setupShifterProxyInEnv
2020
from DIRAC.Core.Utilities.ReturnValues import isReturnStructure
2121
from DIRAC.ConfigurationSystem.Client import PathFinder
22-
from DIRAC.FrameworkSystem.Client.MonitoringClient import MonitoringClient
23-
from DIRAC.FrameworkSystem.Client.MonitoringClient import gMonitor
2422
from DIRAC.Core.Utilities.ThreadScheduler import gThreadScheduler
2523
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
2624

@@ -144,7 +142,6 @@ def __init__(self, agentName, loadName, baseAgentName=False, properties={}):
144142
self.__moduleProperties["shifterProxy"] = False
145143

146144
self.__monitorLastStatsUpdate = -1
147-
self.monitor = None
148145

149146
def __getCodeInfo(self):
150147

@@ -188,8 +185,6 @@ def am_initialize(self, *initArgs):
188185
self.__initializeMonitor()
189186

190187
self.__moduleProperties["shifterProxy"] = self.am_getOption("shifterProxy")
191-
if self.am_monitoringEnabled() and not self.activityMonitoring:
192-
self.monitor.enable()
193188
if len(self.__moduleProperties["executors"]) < 1:
194189
return S_ERROR("At least one executor method has to be defined")
195190
if not self.am_Enabled():
@@ -315,22 +310,6 @@ def __initializeMonitor(self):
315310
self.activityMonitoringReporter = MonitoringReporter(monitoringType="ComponentMonitoring")
316311
# With the help of this periodic task we commit the data to ES at an interval of 100 seconds.
317312
gThreadScheduler.addPeriodicTask(100, self.__activityMonitoringReporting)
318-
else:
319-
if self.__moduleProperties["standalone"]:
320-
self.monitor = gMonitor
321-
else:
322-
self.monitor = MonitoringClient()
323-
self.monitor.setComponentType(self.monitor.COMPONENT_AGENT)
324-
self.monitor.setComponentName(self.__moduleProperties["fullName"])
325-
self.monitor.initialize()
326-
self.monitor.registerActivity("CPU", "CPU Usage", "Framework", "CPU,%", self.monitor.OP_MEAN, 600)
327-
self.monitor.registerActivity("MEM", "Memory Usage", "Framework", "Memory,MB", self.monitor.OP_MEAN, 600)
328-
# Component monitor
329-
for field in ("version", "DIRACVersion", "description", "platform"):
330-
self.monitor.setComponentExtraParam(field, self.__codeProperties[field])
331-
self.monitor.setComponentExtraParam("startTime", Time.dateTime())
332-
self.monitor.setComponentExtraParam("cycles", 0)
333-
self.monitor.disable()
334313
self.__monitorLastStatsUpdate = time.time()
335314

336315
def am_secureCall(self, functor, args=(), name=False):
@@ -410,8 +389,6 @@ def am_go(self):
410389
self.log.warn(" Cycle had an error:", cycleResult["Message"])
411390
self.log.notice("-" * 40)
412391
# Update number of cycles
413-
if not self.activityMonitoring:
414-
self.monitor.setComponentExtraParam("cycles", self.__moduleProperties["cyclesDone"])
415392
# cycle finished successfully, cancel watchdog
416393
if watchdogInt > 0:
417394
signal.alarm(0)
@@ -431,7 +408,6 @@ def _startReportToMonitoring(self):
431408
membytes = MemStat.VmB("VmRSS:")
432409
if membytes:
433410
mem = membytes / (1024.0 * 1024.0)
434-
gMonitor.addMark("MEM", mem)
435411
return (now, cpuTime)
436412
else:
437413
return False
@@ -445,8 +421,7 @@ def _endReportToMonitoring(self, initialWallTime, initialCPUTime):
445421
percentage = 0
446422
if wallTime:
447423
percentage = cpuTime / wallTime * 100.0
448-
if percentage > 0:
449-
gMonitor.addMark("CPU", percentage)
424+
return percentage
450425

451426
def __executeModuleCycle(self):
452427
# Execute the beginExecution function

src/DIRAC/Core/DISET/private/Service.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
from DIRAC.Core.Utilities.DErrno import ENOAUTH
2929
from DIRAC.Core.Utilities.ReturnValues import isReturnStructure
3030
from DIRAC.Core.Utilities.ThreadScheduler import gThreadScheduler
31-
from DIRAC.FrameworkSystem.Client.MonitoringClient import gMonitor
32-
from DIRAC.FrameworkSystem.Client.MonitoringClient import MonitoringClient
3331
from DIRAC.FrameworkSystem.Client.SecurityLogClient import SecurityLogClient
3432

3533

src/DIRAC/FrameworkSystem/private/monitoring/Activity.py

Lines changed: 0 additions & 168 deletions
This file was deleted.

0 commit comments

Comments
 (0)