When requesting builds from Data API, properties can be filtered#1739
When requesting builds from Data API, properties can be filtered#1739sa2ajj merged 3 commits intobuildbot:masterfrom
Conversation
842c6cf to
516b70b
Compare
master/buildbot/data/builds.py
Outdated
There was a problem hiding this comment.
Is it useful to check dbdict? At this step, dbdict must be valid (not None) else it will crash ln 59 when requesting for "id" key, isn't it? Else need to handle the case ln 59.
516b70b to
f1a7c2b
Compare
f1a7c2b to
d7bec70
Compare
|
I'd suggest to handle the case when |
|
And test cases need to be take care of: |
16b04c3 to
1a3a2d5
Compare
|
Please, do not hesitate to review this PR and give me feedback about it :) I'd like it to be merged if there's no problems with it. |
master/buildbot/data/builds.py
Outdated
There was a problem hiding this comment.
I think this variable is not varanted here, it just confuses.
a1fae40 to
73e58bf
Compare
Current coverage is
|
73e58bf to
4b785c3
Compare
There was a problem hiding this comment.
This part should be rather documented in the data api section of the doc. (you can add a reference to it here. dont duplicate doc.)
There was a problem hiding this comment.
the appropriate doc is rtype-builds.rst
There was a problem hiding this comment.
I do not see the rtype-builds.rst file in the developer section.
Should I create it or do you mean rtype-build.rst?
There was a problem hiding this comment.
Yes that's what I meant
Le mar. 28 juil. 2015 19:27, Namgyal Brisson notifications@github.com a
écrit :
In master/buildbot/data/builds.py
#1739 (comment):@@ -20,6 +20,31 @@
class Db2DataMixin(object):
- def _generate_filtered_properties(self, props, filters):
"""This method returns Build's properties according to property filters.I do not see the rtype-builds.rst file in the developer section.
Should I create it or do you mean rtype-build.rst?—
Reply to this email directly or view it on GitHub
https://github.com/buildbot/buildbot/pull/1739/files#r35674934.
4b785c3 to
b5da75c
Compare
|
@tardyp Documentation (& data/builds code) updated |
There was a problem hiding this comment.
[nit] one line would be better and wraps -> wrap
|
LGTM otherwise |
Currently when requesting on Data API for builds (api/v2/builds), each item (build) returned from the JSON structure, does not contain the "properties" field. The drawback of it, is that one's got to request for each build its properties, which is costly in terms of performance and network usage (in particular on big range of data). It should be computed and served from the back-end (Data API). With this patch, one can request builds properties like this: - api/v2/builds/1?property=* (return the whole build's properties) - api/v2/builds/1?property=slavename&property=user (return only desired properties) - api/v2/builds?property=* (return the whole build's properties) - api/v2/builds?property=slavename&property=user (return only desired properties) Fields & Filters can be combined (limit, offset, order, ...) Important: If field(s) is/are specified properties can be retrieved only if field ``properties`` is specified. - api/v2/builds?field=buildid&field=properties&property=slavename&property=user Note: By default, none properties are returned to avoid breaking API. Unit tests & documentation updated accordingly into another commits. Signed-off-by: Namgyal Brisson <namat4css@gmail.com>
…t test) Unit tests added into, * test_data_builds.py * test_data_resultspec.py * test_www_rest.py Some minor adaptations. Signed-off-by: Namgyal Brisson <namat4css@gmail.com>
b5da75c to
6cebb9e
Compare
Documentation updated according to changes. Signed-off-by: Namgyal Brisson <namat4css@gmail.com>
6cebb9e to
534d233
Compare
|
@sa2ajj updated according to comments :) |
|
👍 |
When requesting builds from Data API, properties can be filtered
|
@nam4dev Thank you very much! |
Currently when requesting on Data API for builds (api/v2/builds),
each item (build) returned from the JSON structure,
does not contain the "properties" field.
The drawback of it, is that one's got to request for each build its properties,
which is costly in terms of performance and network usage
(in particular on big range of data).
It should be computed and served from the back-end (Data API).
With this patch, one can request builds properties like this:
Other filters can be combined (limit, offset, order, ...)
Note: By default, none properties are returned to avoid breaking API.
Unit tests updated accordingly.
A ticket is available here: #3284