Skip to content

Commit

Permalink
sweep: #7748 RSS fix: delete the occupancy cache only for older entries
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni authored and web-flow committed Aug 13, 2024
1 parent fb144d9 commit c38190e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/DIRAC/ResourceStatusSystem/Command/FreeDiskSpaceCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@
For the moment, when you see "token" or "space token" here, just read "StorageElement".
"""
import sys
import errno
import sys
from datetime import datetime, timedelta, timezone

from datetime import datetime

from DIRAC import S_OK, S_ERROR
from DIRAC.Core.Utilities.File import convertSizeUnits
from DIRAC import S_ERROR, S_OK
from DIRAC.AccountingSystem.Client.DataStoreClient import gDataStoreClient
from DIRAC.AccountingSystem.Client.Types.StorageOccupancy import StorageOccupancy
from DIRAC.Core.Utilities.File import convertSizeUnits
from DIRAC.DataManagementSystem.Utilities.DMSHelpers import DMSHelpers
from DIRAC.ResourceStatusSystem.Command.Command import Command
from DIRAC.ResourceStatusSystem.Utilities import CSHelpers
from DIRAC.Resources.Storage.StorageElement import StorageElement
from DIRAC.ResourceStatusSystem.Client.ResourceManagementClient import ResourceManagementClient
from DIRAC.ResourceStatusSystem.Command.Command import Command
from DIRAC.ResourceStatusSystem.Utilities import CSHelpers


class FreeDiskSpaceCommand(Command):
Expand Down Expand Up @@ -204,7 +203,9 @@ def _cleanCommand(self, toDelete=None):
if not toDelete:
toDelete = []

res = self.rmClient.selectSpaceTokenOccupancyCache()
res = self.rmClient.selectSpaceTokenOccupancyCache(
meta={"older": ["LastCheckTime", datetime.now(timezone.utc) - timedelta(hours=6)]}
)
if not res["OK"]:
return res
storedSEsSet = {(sse[0], sse[1]) for sse in res["Value"]}
Expand Down

0 comments on commit c38190e

Please sign in to comment.