Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions src/DIRAC/Core/DISET/private/Service.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""
Service class implements the server side part of the DISET protocol
There are 2 main parts in this class:
Service class implements the server side part of the DISET protocol
There are 2 main parts in this class:

- All useful functions for initialization
- All useful functions to handle the requests
- All useful functions for initialization
- All useful functions to handle the requests
"""
# pylint: skip-file
# __searchInitFunctions gives RuntimeError: maximum recursion depth exceeded
Expand Down Expand Up @@ -102,17 +102,10 @@ def initialize(self):
}
self.securityLogging = Operations().getValue("EnableSecurityLogging", False)

# Initialize Monitoring
# The import needs to be here because of the CS must be initialized before importing
# this class (see https://github.com/DIRACGrid/DIRAC/issues/4793)
from DIRAC.MonitoringSystem.Client.MonitoringReporter import MonitoringReporter
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you see that warning ? :-D

Copy link
Copy Markdown
Contributor Author

@fstagni fstagni Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that and considered it, I think. (IUUC, "here" meant not at the beginning)


self.activityMonitoringReporter = MonitoringReporter(monitoringType="ServiceMonitoring")

# Call static initialization function
try:
self._handler["class"]._rh__initializeClass(
dict(self._serviceInfoDict), self._lockManager, self._msgBroker, self.activityMonitoringReporter
dict(self._serviceInfoDict), self._lockManager, self._msgBroker, None
)
if self._handler["init"]:
for initFunc in self._handler["init"]:
Expand All @@ -132,6 +125,10 @@ def initialize(self):
gLogger.exception(errMsg)
return S_ERROR(errMsg)
if self.activityMonitoring:
from DIRAC.MonitoringSystem.Client.MonitoringReporter import MonitoringReporter

self.activityMonitoringReporter = MonitoringReporter(monitoringType="ServiceMonitoring")

gThreadScheduler.addPeriodicTask(30, self.__reportActivity)
gThreadScheduler.addPeriodicTask(100, self.__activityMonitoringReporting)

Expand Down Expand Up @@ -563,6 +560,9 @@ def _executeAction(self, trid, proposalTuple, handlerObj):
retStatus = "OK"
else:
retStatus = "ERROR"
from DIRAC.MonitoringSystem.Client.MonitoringReporter import MonitoringReporter

self.activityMonitoringReporter = MonitoringReporter(monitoringType="ServiceMonitoring")
self.activityMonitoringReporter.addRecord(
{
"timestamp": int(TimeUtilities.toEpochMilliSeconds()),
Expand Down Expand Up @@ -592,6 +592,9 @@ def _mbReceivedMsg(self, trid, msgObj):
handlerObj = result["Value"]
response = handlerObj._rh_executeMessageCallback(msgObj)
if self.activityMonitoring and response["OK"]:
from DIRAC.MonitoringSystem.Client.MonitoringReporter import MonitoringReporter

self.activityMonitoringReporter = MonitoringReporter(monitoringType="ServiceMonitoring")
self.activityMonitoringReporter.addRecord(
{
"timestamp": int(TimeUtilities.toEpochMilliSeconds()),
Expand Down
Loading