From 08745fe8e7ebc020640183ce2a02f0e7d1a154cf Mon Sep 17 00:00:00 2001 From: Alan Malta Rodrigues Date: Wed, 17 Jul 2024 11:13:36 -0400 Subject: [PATCH] Do not consider data size for Tape data placement based on dm_weight --- src/python/WMCore/Services/Rucio/Rucio.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/python/WMCore/Services/Rucio/Rucio.py b/src/python/WMCore/Services/Rucio/Rucio.py index 97fb157cd7..7d439abdc2 100644 --- a/src/python/WMCore/Services/Rucio/Rucio.py +++ b/src/python/WMCore/Services/Rucio/Rucio.py @@ -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 @@ -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)