Skip to content

Commit 07aba0e

Browse files
committed
fix: use threading to avoid blocking initialization
1 parent 59301f1 commit 07aba0e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/DIRAC/WorkloadManagementSystem/Agent/StatesAccountingAgent.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
:caption: StatesAccountingAgent options
99
"""
1010
import datetime
11+
import threading
1112

1213
from DIRAC import S_ERROR, S_OK
1314
from DIRAC.AccountingSystem.Client.DataStoreClient import DataStoreClient
@@ -67,15 +68,13 @@ def initialize(self):
6768
if "Monitoring" in self.pilotMonitoringOption:
6869
self.pilotReporter = MonitoringReporter(monitoringType="PilotsHistory", failoverQueueName=messageQueue)
6970

70-
res = JobDB().fillJobsHistorySummary()
71-
if not res["OK"]:
72-
self.log.error("Could not fill the JobDB summary", res["Message"])
73-
return S_ERROR()
71+
threadJobDB = threading.Thread(target=JobDB().fillJobsHistorySummary)
72+
threadJobDB.daemon = True
73+
threadJobDB.start()
7474

75-
res = PilotAgentsDB().fillPilotsHistorySummary()
76-
if not res["OK"]:
77-
self.log.error("Could not fill the PilotAgentsDB summary", res["Message"])
78-
return S_ERROR()
75+
threadPilotDB = threading.Thread(target=PilotAgentsDB().fillPilotsHistorySummary)
76+
threadPilotDB.daemon = True
77+
threadPilotDB.start()
7978

8079
self.__jobDBFields = []
8180
for field in self.__summaryKeyFieldsMapping:

0 commit comments

Comments
 (0)