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

Add rse=ALL_DOCS to the MSUnmerged info REST API. #11025

Merged
Changes from all commits
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
47 changes: 32 additions & 15 deletions src/python/WMCore/MicroService/MSUnmerged/MSUnmerged.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,21 +822,38 @@ def getStatsFromMongoDB(self, detail=False, **kwargs):
data = {}
if kwargs.get('rse'):
data["query"] = 'rse=%s&detail=%s' % (kwargs['rse'], detail)
mongoProjection = {"_id": False,
"name": True,
"pfnPrefix": True,
"rucioConMonStatus": True,
"isClean": True,
"timestamps": True,
"counters": True}
if detail:
mongoProjection["dirs"] = True

rseList = kwargs['rse'] if isinstance(kwargs['rse'], list) else [kwargs['rse']]
data["rseData"] = []
for rseName in rseList:
mongoFilter = {'name': rseName}
data["rseData"].append(self.msUnmergedColl.find_one(mongoFilter, projection=mongoProjection))
allDocs = (kwargs['rse'].lower() == "all_docs") if isinstance(kwargs['rse'], str) else False

if allDocs:
mongoProjection = {
"_id": False,
"name": True,
"isClean": True,
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't you want to have rucioConMonStatus attribute on this query as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good idea actually. Let me add it into the projection before we merge. And I will also update the commit message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

"rucioConMonStatus": True,
"counters": {
"gfalErrors": True,
"dirsToDelete": True,
"dirsDeletedSuccess": True,
"dirsDeletedFail": True}}
mongoFilter = {}
data["rseData"] = list(self.msUnmergedColl.find(mongoFilter, projection=mongoProjection))
else:
mongoProjection = {
"_id": False,
"name": True,
"isClean": True,
"pfnPrefix": True,
"rucioConMonStatus": True,
"timestamps": True,
"counters": True}
if detail:
mongoProjection["dirs"] = True

rseList = kwargs['rse'] if isinstance(kwargs['rse'], list) else [kwargs['rse']]
data["rseData"] = []
for rseName in rseList:
mongoFilter = {'name': rseName}
data["rseData"].append(self.msUnmergedColl.find_one(mongoFilter, projection=mongoProjection))
return data

# @profile
Expand Down