Skip to content

Commit

Permalink
Merge pull request #7446 from DIRACGridBot/cherry-pick-2-970cb7a91-in…
Browse files Browse the repository at this point in the history
…tegration

[sweep:integration] StatesAccountingAgent: skip the first iteration in order to avoid double commit after a restart
  • Loading branch information
fstagni authored Feb 7, 2024
2 parents d9c424c + 6427378 commit 44798d5
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 44798d5

Please sign in to comment.