-
Notifications
You must be signed in to change notification settings - Fork 107
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
Use POST method for getting pileup documents in MSTransferor #11936
Conversation
Log number of pileup documents and pileup query executed
Jenkins results:
|
Jenkins results:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks Alan.
Thanks Dennis! |
@amaltaro , @d-ylee , it is pity that it is already merged. I was away for two days and haven't had time to provide my input. The issue you fixed with switching to POST goes against HTTP standard which mandate that POST requests must be used for creation of resources and not for data retrieval which is reserved for GET requests. To manage JSON data you can still use GET, and here is a proof using Go code (which is much more intuitive and easier to demonstrate for this issue):
and if I compile it and run, e.g.
So, both requests properly shows the payload which is parsed and printed by the server. This proofs that using JSON payload works just fine with HTTP GET requests. Does Python (and in particular our WMCore web server) can handle this properly is an open question but we should not break HTTP standard. Such logic break logic of APIs and their intend. I hope we can re-open this issue to switch back to GET request (but it requires testing) or create another issue to address this. |
@vkuznet Valentin, the actual problem is when the request with a JSON (actually python dictionary) gets expanded to the URL that we want to access, and this is not represented in your example above, as you are querying one specific endpoint without any query string, as it is required in some cases of MSPileup. In addition to that, it looks like you have missed this fundamental standard of HTTP method types and the actual actions, given that you implemented it here: with either resource creation or resource retrieve, based on a MongoDB query. Last but not least, if you really think this needs to be refactored, I would suggest to go with a new ticket (given that refactoring goes beyond of the changes provided here) and we work on that in the near future. Right now we are stuck and very late with validating and rolling things to production, I'd rather not have yet another blocker on this. |
Alan, I see two issues here:
In iniital implementation of MSCore/MSPileup I provided basic end-points but I don't recall that we had full list of all possible use-cases. This is why we now address this. For instance, using GET method it is totally fine to combine parameters and JSON payload, e.g. here is an example of GET query using both using my previous example:
Therefore, I suggest to open a ticket with outlining use-cases and end-point usage, then we can adjust the code to properly work with end-points for all different use-cases. |
Fixes #11935
Complement to #11910
Status
ready
Description
The title says it all, use the POST instead of GET method for retrieving pileup documents with a specific query string.
Is it backward compatible (if not, which system it affects?)
YES
Related PRs
None
External dependencies / deployment changes
None