Conversation
b4884f4 to
c558aed
Compare
|
Conflicting PR. Removed from build OMERO-DEV-merge-push#584. See the console output for more details.
|
|
Conflicting PR. Removed from build OMERO-DEV-merge-push#585. See the console output for more details.
|
|
Conflicting PR. Removed from build OMERO-DEV-merge-push#593. See the console output for more details.
|
| unnecessary objects to query. | ||
| We return just the query and omero.sys.ParametersI for the query. | ||
|
|
||
| :param obj_type: Object type. E.g. "Project" see above |
| :param opts: Dict of options for filtering by | ||
| offset, limit and owner for all objects. | ||
| Additional opts handled by _getQueryString() | ||
| E.g. filter Dataset by 'project' |
| from functools import update_wrapper | ||
| from api_exceptions import NotFoundError, BadRequestError, CreatedObject | ||
| from api_exceptions import NotFoundError, BadRequestError, CreatedObject, \ | ||
| MethodNotSupportedError |
| E.g. filter Dataset by 'project' | ||
| :return: (query, params) | ||
| """ | ||
| # We disable pagination since we want to count ALL results |
There was a problem hiding this comment.
something to test for large number of results returned
|
|
||
| # For any given release of api, we may support | ||
| # one or more versions of the api. | ||
| # E.g. /api/v1.0/ |
| # Check that page 2 gives next 2 projects | ||
| page = 2 | ||
| payload = {'limit': limit, 'page': page} | ||
| payload = {'limit': limit, 'offset': limit} |
There was a problem hiding this comment.
just to avoid possible mistake or miss some errors, I will use different values e.g. limit 2 projects 3 instead of 2/2
|
FYI Point 1: this is difficult in the sense that for example all projects are loaded via api and not possible to verify in client e.g. log as "root" |
|
@jburel You can reproduce client behaviour of filtering by group & owner by using |
|
I was going for the general call. I think it will be better to rely on a test b/c I have to use filtering in order to validate. This means that I cannot validate w/o filtering |
|
OK, I will add a test that checks the "totalCount" when filtering by group & owner. |
for example, duplicate Wells were being counted, 1 per WellSample.
|
Last commit fixes this issue: Wells are loaded with this query: Wells were being counted with this query: |
|
why do you need all optional joins if you don't use them in counting query? |
|
For every query that we make with the /api/ we also do a 'count' query, so there is a simple conversion function that creates the 'count' query from the original 'data loading' query. Any more-complex conversion we do will have to work with ALL the queries, so will need to be more customised to different data types. |
|
To test last few commits:
|
|
|
|
If I go to https://cowfish.openmicroscopy.org/webtrial/api/v0/m/projects/?limit=-1 |
|
That's not the problem. |
|
If I use ?limit=0 (which is supported by the OMERO api) I get this, which is potentially useful |
|
Ah, OK - sorry. Yes, I guess the smallest |
|
It is useful if do not have any results |
|
Very strange - I can repeat locally too. But I think this must be something about that particular query, (loading Wells and joining WellSamples etc) that is causing limit=0 to be interpreted as limit=1. |
|
it works for projects, datasets etc. |
Having this fail silently and return 0 is not helpful. Users need to know that something has gone wrong. Now uses same logic as webcient views.get_long_or_default()
|
@joshmoore Any idea why using params of When I don't load WellSamples etc then @jburel I now handle config of |
This might be caused by https://hibernate.atlassian.net/browse/HHH-8989 -- can you detect when |
|
The negative values are now correctly handled |
|
Sorry - missed @joshmoore's comment notification somehow. Yes, that should be trivial to do. |
|
Looks good Thanks all |
What this PR does
Updates pagination to use
?offset=200to show page 2 of results instead of?page=2.We also count the total number of objects that would be returned by all "list objects" queries and return this in a new
"meta"json object, along with other pagination info (current limit, offset & max limit):E.g.
/images/This PR also adds new config settings for the default api "limit" and the "max limit" in a new
api_settings.py. Other api settings have also been moved to this file.Testing this PR
"meta"in json.?offset=100and / or?limit=50. Check that these values are shown in "meta" (and that they do pagination as expected)?limit=1000. Should see that the actual limit used in the query is restricted to the max_limit (500).bin/omero config set omero.web.api.limit 300bin/omero config set omero.web.api.max_limit 1000Related reading
Discussed at web meeting 2017-01-26 and 2017-02-08