19
19
from DIRAC .Core .Utilities .Shifter import setupShifterProxyInEnv
20
20
from DIRAC .Core .Utilities .ReturnValues import isReturnStructure
21
21
from DIRAC .ConfigurationSystem .Client import PathFinder
22
- from DIRAC .FrameworkSystem .Client .MonitoringClient import MonitoringClient
23
- from DIRAC .FrameworkSystem .Client .MonitoringClient import gMonitor
24
22
from DIRAC .Core .Utilities .ThreadScheduler import gThreadScheduler
25
23
from DIRAC .ConfigurationSystem .Client .Helpers .Operations import Operations
26
24
@@ -144,7 +142,6 @@ def __init__(self, agentName, loadName, baseAgentName=False, properties={}):
144
142
self .__moduleProperties ["shifterProxy" ] = False
145
143
146
144
self .__monitorLastStatsUpdate = - 1
147
- self .monitor = None
148
145
149
146
def __getCodeInfo (self ):
150
147
@@ -188,8 +185,6 @@ def am_initialize(self, *initArgs):
188
185
self .__initializeMonitor ()
189
186
190
187
self .__moduleProperties ["shifterProxy" ] = self .am_getOption ("shifterProxy" )
191
- if self .am_monitoringEnabled () and not self .activityMonitoring :
192
- self .monitor .enable ()
193
188
if len (self .__moduleProperties ["executors" ]) < 1 :
194
189
return S_ERROR ("At least one executor method has to be defined" )
195
190
if not self .am_Enabled ():
@@ -315,22 +310,6 @@ def __initializeMonitor(self):
315
310
self .activityMonitoringReporter = MonitoringReporter (monitoringType = "ComponentMonitoring" )
316
311
# With the help of this periodic task we commit the data to ES at an interval of 100 seconds.
317
312
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 ()
334
313
self .__monitorLastStatsUpdate = time .time ()
335
314
336
315
def am_secureCall (self , functor , args = (), name = False ):
@@ -410,8 +389,6 @@ def am_go(self):
410
389
self .log .warn (" Cycle had an error:" , cycleResult ["Message" ])
411
390
self .log .notice ("-" * 40 )
412
391
# Update number of cycles
413
- if not self .activityMonitoring :
414
- self .monitor .setComponentExtraParam ("cycles" , self .__moduleProperties ["cyclesDone" ])
415
392
# cycle finished successfully, cancel watchdog
416
393
if watchdogInt > 0 :
417
394
signal .alarm (0 )
@@ -431,7 +408,6 @@ def _startReportToMonitoring(self):
431
408
membytes = MemStat .VmB ("VmRSS:" )
432
409
if membytes :
433
410
mem = membytes / (1024.0 * 1024.0 )
434
- gMonitor .addMark ("MEM" , mem )
435
411
return (now , cpuTime )
436
412
else :
437
413
return False
@@ -445,8 +421,7 @@ def _endReportToMonitoring(self, initialWallTime, initialCPUTime):
445
421
percentage = 0
446
422
if wallTime :
447
423
percentage = cpuTime / wallTime * 100.0
448
- if percentage > 0 :
449
- gMonitor .addMark ("CPU" , percentage )
424
+ return percentage
450
425
451
426
def __executeModuleCycle (self ):
452
427
# Execute the beginExecution function
0 commit comments