Skip to content

Commit

Permalink
correct use of rucio.get_local_account_usage. Fix #8738 (#8739)
Browse files Browse the repository at this point in the history
  • Loading branch information
belforte authored Oct 11, 2024
1 parent 0bec3b5 commit c5d4248
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/python/ServerUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -1073,17 +1073,18 @@ def isEnoughRucioQuota(rucioClient, site, account=''):
}
if not account:
account = rucioClient.account
quotas = list(rucioClient.get_local_account_usage(account, site))
if quotas:
ret['hasQuota'] = True
quota = quotas[0]
ret['total'] = quota['bytes_limit'] / 2 ** (10 * 3) # GiB
ret['used'] = quota['bytes'] / 2 ** (10 * 3) # GiB
ret['free'] = quota['bytes_remaining'] / 2 ** (10 * 3) # GiB
if ret['free'] > RUCIO_QUOTA_MINIMUM_GB:
ret['isEnough'] = True
if ret['free'] <= RUCIO_QUOTA_WARNING_GB:
ret['isQuotaWarning'] = True
quotas = rucioClient.get_local_account_usage(account, site)
for quota in quotas:
if quota['rse'] == site:
ret['hasQuota'] = True
ret['total'] = quota['bytes_limit'] / 2 ** (10 * 3) # GiB
ret['used'] = quota['bytes'] / 2 ** (10 * 3) # GiB
ret['free'] = quota['bytes_remaining'] / 2 ** (10 * 3) # GiB
if ret['free'] > RUCIO_QUOTA_MINIMUM_GB:
ret['isEnough'] = True
if ret['free'] <= RUCIO_QUOTA_WARNING_GB:
ret['isQuotaWarning'] = True
break
return ret


Expand Down

0 comments on commit c5d4248

Please sign in to comment.