|
1 | 1 | """ |
2 | | - Service class implements the server side part of the DISET protocol |
3 | | - There are 2 main parts in this class: |
| 2 | +Service class implements the server side part of the DISET protocol |
| 3 | +There are 2 main parts in this class: |
4 | 4 |
|
5 | | - - All useful functions for initialization |
6 | | - - All useful functions to handle the requests |
| 5 | +- All useful functions for initialization |
| 6 | +- All useful functions to handle the requests |
7 | 7 | """ |
8 | 8 | # pylint: skip-file |
9 | 9 | # __searchInitFunctions gives RuntimeError: maximum recursion depth exceeded |
@@ -102,17 +102,10 @@ def initialize(self): |
102 | 102 | } |
103 | 103 | self.securityLogging = Operations().getValue("EnableSecurityLogging", False) |
104 | 104 |
|
105 | | - # Initialize Monitoring |
106 | | - # The import needs to be here because of the CS must be initialized before importing |
107 | | - # this class (see https://github.com/DIRACGrid/DIRAC/issues/4793) |
108 | | - from DIRAC.MonitoringSystem.Client.MonitoringReporter import MonitoringReporter |
109 | | - |
110 | | - self.activityMonitoringReporter = MonitoringReporter(monitoringType="ServiceMonitoring") |
111 | | - |
112 | 105 | # Call static initialization function |
113 | 106 | try: |
114 | 107 | self._handler["class"]._rh__initializeClass( |
115 | | - dict(self._serviceInfoDict), self._lockManager, self._msgBroker, self.activityMonitoringReporter |
| 108 | + dict(self._serviceInfoDict), self._lockManager, self._msgBroker, None |
116 | 109 | ) |
117 | 110 | if self._handler["init"]: |
118 | 111 | for initFunc in self._handler["init"]: |
@@ -563,6 +556,9 @@ def _executeAction(self, trid, proposalTuple, handlerObj): |
563 | 556 | retStatus = "OK" |
564 | 557 | else: |
565 | 558 | retStatus = "ERROR" |
| 559 | + from DIRAC.MonitoringSystem.Client.MonitoringReporter import MonitoringReporter |
| 560 | + |
| 561 | + self.activityMonitoringReporter = MonitoringReporter(monitoringType="ServiceMonitoring") |
566 | 562 | self.activityMonitoringReporter.addRecord( |
567 | 563 | { |
568 | 564 | "timestamp": int(TimeUtilities.toEpochMilliSeconds()), |
@@ -592,6 +588,9 @@ def _mbReceivedMsg(self, trid, msgObj): |
592 | 588 | handlerObj = result["Value"] |
593 | 589 | response = handlerObj._rh_executeMessageCallback(msgObj) |
594 | 590 | if self.activityMonitoring and response["OK"]: |
| 591 | + from DIRAC.MonitoringSystem.Client.MonitoringReporter import MonitoringReporter |
| 592 | + |
| 593 | + self.activityMonitoringReporter = MonitoringReporter(monitoringType="ServiceMonitoring") |
595 | 594 | self.activityMonitoringReporter.addRecord( |
596 | 595 | { |
597 | 596 | "timestamp": int(TimeUtilities.toEpochMilliSeconds()), |
|
0 commit comments