Skip to content

Commit

Permalink
refactor (SE): StorageElement plugins parameter becomes protocolSections
Browse files Browse the repository at this point in the history
  • Loading branch information
chaen committed Jun 2, 2022
1 parent ee3fff5 commit 38496cd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions src/DIRAC/Resources/Storage/StorageElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class StorageElementCache(object):
def __init__(self):
self.seCache = DictCache()

def __call__(self, name, plugins=None, vo=None, hideExceptions=False):
def __call__(self, name, protocolSections=None, vo=None, hideExceptions=False):
self.seCache.purgeExpired(expiredInSeconds=60)
tId = threading.current_thread().ident

Expand All @@ -67,15 +67,15 @@ def __call__(self, name, plugins=None, vo=None, hideExceptions=False):
# If we see its memory consumtpion exploding, this might be a place to look
proxyLoc = getProxyLocation()

# ensure plugins is hashable! (tuple)
if isinstance(plugins, list):
plugins = tuple(plugins)
# ensure protocolSections is hashable! (tuple)
if isinstance(protocolSections, list):
protocolSections = tuple(protocolSections)

argTuple = (tId, name, plugins, vo, proxyLoc)
argTuple = (tId, name, protocolSections, vo, proxyLoc)
seObj = self.seCache.get(argTuple)

if not seObj:
seObj = StorageElementItem(name, plugins, vo, hideExceptions=hideExceptions)
seObj = StorageElementItem(name, protocolSections=protocolSections, vo=vo, hideExceptions=hideExceptions)
# Add the StorageElement to the cache for 1/2 hour
self.seCache.add(argTuple, 1800, seObj)

Expand Down Expand Up @@ -164,19 +164,19 @@ class StorageElementItem(object):
"getDirectory": {"localPath": False},
}

def __init__(self, name, plugins=None, vo=None, hideExceptions=False):
def __init__(self, name, protocolSections=None, vo=None, hideExceptions=False):
"""c'tor
:param str name: SE name
:param list plugins: requested storage plugins
:param list protocolSections: requested storage protocolSections
:param vo: vo
"""

self.methodName = None

if plugins is None:
plugins = []
if protocolSections is None:
protocolSections = []

if vo:
self.vo = vo
Expand All @@ -202,7 +202,7 @@ def __init__(self, name, plugins=None, vo=None, hideExceptions=False):
self.valid = True

res = StorageFactory(useProxy=self.useProxy, vo=self.vo).getStorages(
name, protocolSections=plugins, hideExceptions=hideExceptions
name, protocolSections=protocolSections, hideExceptions=hideExceptions
)

if not res["OK"]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __monitorStorageElementStageRequests(self, storageElement, seReplicaIDs, rep
oAccounting = DataOperation()
oAccounting.setStartTime()

res = StorageElement(storageElement, plugins=self.storagePlugins).getFileMetadata(lfnRepIDs)
res = StorageElement(storageElement, protocolSections=self.storagePlugins).getFileMetadata(lfnRepIDs)
if not res["OK"]:
gLogger.error(
"StageMonitor.__monitorStorageElementStageRequests: Completely failed to monitor stage requests for replicas",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def setUp(self, pluginToTest):
# When testing for a given plugin, this plugin might not be able to
# write or read. In this case, we use this specific plugins
# ONLY for the operations it is allowed to
specSE = StorageElement(self.storageName, plugins=pluginToTest)
specSE = StorageElement(self.storageName, protocolSections=pluginToTest)
genericSE = StorageElement(self.storageName)

pluginProtocol = specSE.protocolOptions[0]["Protocol"]
Expand Down

0 comments on commit 38496cd

Please sign in to comment.