Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sweep:integration] fix (RSS): do not use timezone datetime #7765

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading