Skip to content

Add statistics from response headers for query_multiple #75

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

Merged
merged 7 commits into from
Oct 28, 2020

Conversation

vossen-adobe
Copy link
Contributor

The information is already available in the response headers. My goal with this PR is to add them to the QueryMultiple class as instance variables. This way, when a users or groups query is run (for example, in umapi.py in UST), the resulting object includes the meta info about results.

Here, I added the instance variables to track the following for each request made:

_total_count = x-total-count
_page_size = x-page-count
_page_count = x-current-page
_page_number = x-page-size

Since the info is already on the response, no extra work is needed but to track and set them. Using the resulting fields, it is possible to track the progress of a prolonged umapi run - which is especially useful in user sync tool, where runs often exceed several hours. In a separate PR, I will utilize this feature to add the progress logging in UST.

No new tests are added, but existing tests using mock response have been updated to test these fields as well. The travis failure is because of a dependency issue between pyyaml and python 3.4 - not related to these changes.

Copy link
Contributor

@adorton-adobe adorton-adobe left a comment

Choose a reason for hiding this comment

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

We should add a method to QueryMultiple that returns these new stats so we don't have to access private members of the object. Maybe stats() or something like that.

@vossen-adobe
Copy link
Contributor Author

@adorton-adobe This is up to date and resolved

@adorton-adobe adorton-adobe added this to the v2.15 milestone Oct 28, 2020
@adorton-adobe adorton-adobe merged commit 794cc7d into adobe-apiplatform:v2 Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants