Skip to content

Commit

Permalink
Merge pull request #7935 from sfayer/fix_cloudcleanup
Browse files Browse the repository at this point in the history
[9.0] Run CE cleanup step at correct point
  • Loading branch information
fstagni authored Dec 6, 2024
2 parents d514ece + 4538e95 commit c4b7a6e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,11 @@ def _monitorPilotsPerQueue(self, queue: str):
ceType = self.queueDict[queue]["CEType"]
siteName = self.queueDict[queue]["Site"]

# Call cleanup before checking pilot statuses (so cleanup always runs)
# This is needed to delete things like old cloud instances after the pilots are done
if callable(getattr(ce, "cleanupPilots", None)):
ce.cleanupPilots()

# Select pilots in a transient states
result = self.pilotAgentsDB.selectPilots(
{
Expand Down Expand Up @@ -799,10 +804,6 @@ def _monitorPilotsPerQueue(self, queue: str):
# Update the status of the pilots in the DB
self._updatePilotsInDB(updatedPilots)

# FIXME: seems like it is only used by the CloudCE? Couldn't it be called from CloudCE.getJobStatus()?
if callable(getattr(ce, "cleanupPilots", None)):
ce.cleanupPilots()

# Check if the accounting is to be sent
if self.sendAccounting:
result = self.pilotAgentsDB.selectPilots(
Expand Down

0 comments on commit c4b7a6e

Please sign in to comment.