Skip to content

Commit

Permalink
Merge pull request DIRACGrid#7765 from DIRACGridBot/cherry-pick-2-623…
Browse files Browse the repository at this point in the history
…51f92d-integration

[sweep:integration] fix (RSS): do not use timezone datetime
  • Loading branch information
fstagni authored Aug 28, 2024
2 parents b802887 + 019b648 commit 2aa75fc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/DIRAC/DataManagementSystem/Client/FTS3Job.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ def monitor(self, context=None, ftsServer=None, ucert=None):
# monitoring calls
if file_state in FTS3File.FTS_FINAL_STATES:
filesStatus[file_id]["ftsGUID"] = None
# TODO: update status to defunct if not recoverable here ?

# If the file is not in a final state, but the job is, we return an error
# FTS can have inconsistencies where the FTS Job is in a final state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"""
import errno
import sys
from datetime import datetime, timedelta, timezone
from datetime import datetime, timedelta

from DIRAC import S_ERROR, S_OK
from DIRAC.AccountingSystem.Client.DataStoreClient import gDataStoreClient
Expand Down Expand Up @@ -204,7 +204,7 @@ def _cleanCommand(self, toDelete=None):
toDelete = []

res = self.rmClient.selectSpaceTokenOccupancyCache(
meta={"older": ["LastCheckTime", datetime.now(timezone.utc) - timedelta(hours=6)]}
meta={"older": ["LastCheckTime", datetime.utcnow() - timedelta(hours=6)]}
)
if not res["OK"]:
return res
Expand Down
20 changes: 15 additions & 5 deletions src/DIRAC/Resources/Storage/StorageElement.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
""" This is the StorageElement module. It implements The StorageElementItem as well as the caching system
"""

# # custom duty


Expand Down Expand Up @@ -257,11 +258,13 @@ def __init__(self, name, protocolSections=None, vo=None, hideExceptions=False):
self.localStageProtocolList = (
stageProto
if stageProto
else accessProto
if accessProto
else globalStageProto
if globalStageProto
else self.localAccessProtocolList
else (
accessProto
if accessProto
else globalStageProto
if globalStageProto
else self.localAccessProtocolList
)
)
self.log.debug(f"localStageProtocolList {self.localStageProtocolList}")

Expand Down Expand Up @@ -421,6 +424,13 @@ def getOccupancy(self, unit="MB", **kwargs):
"""
log = self.log.getSubLogger("getOccupancy")

res = self.isValid(operation="getOccupancy")
if not res["OK"]:
return res
else:
if not self.valid:
return S_ERROR(self.errorReason)

if "occupancyLFN" not in kwargs:
occupancyLFN = self.options.get("OccupancyLFN")
if not occupancyLFN:
Expand Down

0 comments on commit 2aa75fc

Please sign in to comment.