Skip to content

Commit

Permalink
Merge pull request #12045 from amaltaro/fix-12044
Browse files Browse the repository at this point in the history
Do not consider data size for Tape data placement based on dm_weight
  • Loading branch information
amaltaro authored Jul 22, 2024
2 parents 3fae2bb + 08745fe commit 025001d
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/python/WMCore/Services/Rucio/Rucio.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ def pickRSE(self, rseExpression='rse_type=TAPE\cms_type=test', rseAttribute='ddm
"""
_pickRSE_
Use a weighted random selection algorithm to pick an RSE for a dataset based on an attribute
Use a weighted random selection algorithm to pick an RSE for a dataset based on an RSE attribute.
The attribute should correlate to space available.
:param rseExpression: Rucio RSE expression to pick RSEs (defaults to production Tape RSEs)
:param rseAttribute: The RSE attribute to use as a weight. Must be a number
Expand All @@ -757,18 +757,21 @@ def pickRSE(self, rseExpression='rse_type=TAPE\cms_type=test', rseAttribute='ddm
rsesWeight = []

for rse in matchingRSEs:
attrs = self.cli.list_rse_attributes(rse)
rseAttrs = self.cli.list_rse_attributes(rse)
if rseAttribute:
try:
quota = float(attrs.get(rseAttribute, 0))
attrValue = float(rseAttrs.get(rseAttribute, 0))
except (TypeError, KeyError):
quota = 0
attrValue = 0
else:
quota = 1
requiresApproval = attrs.get('requires_approval', False)
if quota > minNeeded:
attrValue = 1
requiresApproval = rseAttrs.get('requires_approval', False)
if rseAttribute == "ddm_quota" and attrValue > minNeeded:
rsesWithApproval.append((rse, requiresApproval))
rsesWeight.append(attrValue)
elif rseAttribute != "ddm_quota": # e.g. dm_weight
rsesWithApproval.append((rse, requiresApproval))
rsesWeight.append(quota)
rsesWeight.append(attrValue)

return weightedChoice(rsesWithApproval, rsesWeight)

Expand Down

0 comments on commit 025001d

Please sign in to comment.