Skip to content

Commit

Permalink
Merge pull request #7755 from DIRACGridBot/cherry-pick-2-05ed5becd-in…
Browse files Browse the repository at this point in the history
…tegration

[sweep:integration] RSS fix: delete the occupancy cache only for older entries
  • Loading branch information
fstagni committed Aug 13, 2024
2 parents fb144d9 + c38190e commit d8cc838
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 d8cc838

Please sign in to comment.