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

MSUnmerged: Create a REST API for all RSEs' state #10995

Closed
todor-ivanov opened this issue Feb 14, 2022 · 5 comments · Fixed by #11025
Closed

MSUnmerged: Create a REST API for all RSEs' state #10995

todor-ivanov opened this issue Feb 14, 2022 · 5 comments · Fixed by #11025

Comments

@todor-ivanov
Copy link
Contributor

Impact of the new feature
MSUnmerged

Is your feature request related to a problem? Please describe.
While monitoring the overall work performed by the service tracked in the following issue [1], we've found that the single database query used for extracting the error counters for all the RSEs is quite useful. Provided this is a single call, It is quite logical to have it implemented as a REST API to the service, so that the information is easily exposed.

Describe the solution you'd like
Implement the following REST API:
https://cmsweb.cern.ch/ms-unmerged/data/info?rse=ALL_DOCS

Which should provide the output from the following query to MongoDB:

In [47]: filter = {}

In [48]: projection = {
    ...:     "_id": False,
    ...:     "name": True,
    ...:     "isClean": True,
    ...:     "counters": {
    ...:         "gfalErrors": True,
    ...:         "dirsToDelete": True,
    ...:         "dirsDeletedSuccess": True,
    ...:         "dirsDeletedFail": True}}

In [49]: list(msUnmergedCollProd.find(filter, projection))
Out[49]: 
[{'name': 'T1_US_FNAL_Disk',
  'isClean': True,
  'counters': {'dirsToDelete': 37,
   'dirsDeletedSuccess': 37,
   'dirsDeletedFail': 0,
   'gfalErrors': {}}},
   ...
   {'name': 'T2_ES_CIEMAT',
  'isClean': False,
  'counters': {'dirsToDelete': 514,
   'dirsDeletedSuccess': 512,
   'dirsDeletedFail': 2,
   'gfalErrors': {'No such file or directory': 2586}}}]

Describe alternatives you've considered
Using the query only from python for debugging.

Additional context
None

@todor-ivanov
Copy link
Contributor Author

FYI @amaltaro

@todor-ivanov
Copy link
Contributor Author

@amaltaro already made a really good suggestion regarding micro services REST APIs consistency. In order to stay in line with the similar interface already implemented for MStransferor we should use the following API + Auxiliary function:

https://github.com/dmwm/WMCore/wiki/ReqMgr2-apis#retrieve-a-workflow-transfer-document

if subName.lower() == "all_docs":

@todor-ivanov
Copy link
Contributor Author

todor-ivanov commented Mar 7, 2022

While working on the issue I realized that the above method and class suggested by @amaltaro are not part of any of the micro services' APIs but they are part of the Reqmgr ones. And also this whole piece of code actually relates to the CouchDB interface. And we have no MongoDB interface developed and plugged into Reqmgr. So I would not create a new API to Reqmgr2 of the sort:
https://cmsweb.cern.ch/reqmgr2/data/unmerged/ALL_DOCS ,

only to be able to use this Auxiliaryclass (which has been developed around CouchDB interface and will need quite of a change to get linked to MongoDB as well), but I'd rather mimic this uri and use the already developed micro service's info REST API to get the information, which is already properly linked with MongoDB and very well tested. So the uri should look more like:
https://cmsweb.cern.ch/ms-unmerged/data/info?rse=ALL_DOCS

As stated into the issue description. And in case we decide we'd want an API from Reqmgr linked to the information stored in MongoDB, then we should create a separate issue, which should not be related to MSUnmerged only.

@amaltaro
Copy link
Contributor

amaltaro commented Mar 7, 2022

That's the way to go, Todor. I didn't mean to use the same implementation of ReqMgr Aux module, but only the same convention to retrieve all the documents (from the user point of view).

@todor-ivanov
Copy link
Contributor Author

Got it. Thanks Alan! A PR is on its way already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants