Skip to content

Commit 4538e95

Browse files
committedDec 5, 2024
fix: Run CE cleanup step at correct point
1 parent d514ece commit 4538e95

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎src/DIRAC/WorkloadManagementSystem/Agent/SiteDirector.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,11 @@ def _monitorPilotsPerQueue(self, queue: str):
750750
ceType = self.queueDict[queue]["CEType"]
751751
siteName = self.queueDict[queue]["Site"]
752752

753+
# Call cleanup before checking pilot statuses (so cleanup always runs)
754+
# This is needed to delete things like old cloud instances after the pilots are done
755+
if callable(getattr(ce, "cleanupPilots", None)):
756+
ce.cleanupPilots()
757+
753758
# Select pilots in a transient states
754759
result = self.pilotAgentsDB.selectPilots(
755760
{
@@ -799,10 +804,6 @@ def _monitorPilotsPerQueue(self, queue: str):
799804
# Update the status of the pilots in the DB
800805
self._updatePilotsInDB(updatedPilots)
801806

802-
# FIXME: seems like it is only used by the CloudCE? Couldn't it be called from CloudCE.getJobStatus()?
803-
if callable(getattr(ce, "cleanupPilots", None)):
804-
ce.cleanupPilots()
805-
806807
# Check if the accounting is to be sent
807808
if self.sendAccounting:
808809
result = self.pilotAgentsDB.selectPilots(

0 commit comments

Comments
 (0)