Skip to content

Commit

Permalink
Merge pull request #7434 from fstagni/80_avoid_double_counting
Browse files Browse the repository at this point in the history
[8.0] StatesAccountingAgent: skip the first iteration in order to avoid double commit after a restart
  • Loading branch information
chrisburr authored Feb 7, 2024
2 parents 99f68cc + a693aec commit 970cb7a
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"""
import datetime

from DIRAC import S_OK, S_ERROR
from DIRAC import S_ERROR, S_OK
from DIRAC.AccountingSystem.Client.DataStoreClient import DataStoreClient
from DIRAC.AccountingSystem.Client.Types.WMSHistory import WMSHistory
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
from DIRAC.Core.Base.AgentModule import AgentModule
from DIRAC.Core.Utilities import TimeUtilities
from DIRAC.AccountingSystem.Client.Types.WMSHistory import WMSHistory
from DIRAC.AccountingSystem.Client.DataStoreClient import DataStoreClient
from DIRAC.MonitoringSystem.Client.MonitoringReporter import MonitoringReporter
from DIRAC.WorkloadManagementSystem.DB.JobDB import JobDB
from DIRAC.WorkloadManagementSystem.DB.PilotAgentsDB import PilotAgentsDB
Expand Down Expand Up @@ -76,6 +76,12 @@ def initialize(self):

def execute(self):
"""Main execution method"""

# on the first iteration of the agent, do nothing in order to avoid double committing after a restart
if self.am_getModuleParam("cyclesDone") == 0:
self.log.notice("Skipping the first iteration of the agent")
return S_OK()

# PilotsHistory to Monitoring
if "Monitoring" in self.pilotMonitoringOption:
self.log.info("Committing PilotsHistory to Monitoring")
Expand Down

0 comments on commit 970cb7a

Please sign in to comment.