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

Fix #8661 changing local account usage to tape recall usage in quota report #8697

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 7 additions & 5 deletions src/python/RucioUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,15 @@ def getRuleQuota(rucioClient=None, ruleId=None):
size = sum(file['bytes'] for file in files)
return size


def getTapeRecallUsage(rucioClient=None, account=None):
""" size of ongoing tape recalls for this account """
""" size of ongoing tape recalls for this account (if provided) or by activity """
activity = 'Analysis TapeRecall'
rucioAccount = account
rules = rucioClient.list_replication_rules(
filters={'account': rucioAccount, 'activity': activity})
filters = {'activity': activity}

if account is not None:
filters['account'] = account

rules = rucioClient.list_replication_rules(filters=filters)
usage = sum(getRuleQuota(rucioClient, rule['id']) for rule in rules\
if rule['state'] in ['REPLICATING', 'STUCK', 'SUSPENDED']) # in Bytes
return usage
14 changes: 4 additions & 10 deletions src/script/Monitor/ReportRecallQuota.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import requests
from requests.auth import HTTPBasicAuth
from python.RucioUtils import getTapeRecallUsage

FMT = "%Y-%m-%dT%H:%M:%S%z"
WORKDIR = '/data/srv/monit/'
Expand All @@ -29,18 +30,11 @@ def readpwd():
def createQuotaReport(rucioClient=None, account=None):
"""
create a dictionary with the quota report to be sent to MONIT
even if we do not report usage at single RSE's now, let's collect that info as well
returns {'rse1':bytes, 'rse':bytes,..., 'totalTB':TBypte}
we do not report usage at single RSE's now, we don't collect that info either
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i suggest to remove this comment which was specific of using get_local_account_usage

returns {'totalTB':TBypte}
"""

usageGenerator = rucioClient.get_local_account_usage(account=account)
totalBytes = 0
totalBytes = getTapeRecallUsage(rucioClient=rucioClient,account=None)
report = {}
for usage in usageGenerator:
rse = usage['rse']
used = usage['bytes']
report[rse] = used // 1e12
totalBytes += used
totalTB = totalBytes // 1e12
report['totalTB'] = totalTB
return report
Expand Down