| |
@@ -3510,7 +3510,7 @@
|
| |
else:
|
| |
raise
|
| |
|
| |
- def module_overview(self, limit=10, finished=True):
|
| |
+ def module_overview(self, limit=10, finished=True, owner=None):
|
| |
"""
|
| |
Show the overview of the latest builds in MBS
|
| |
|
| |
@@ -3518,6 +3518,7 @@
|
| |
to display. This defaults to 10.
|
| |
:param bool finished: a boolean that determines if only finished or
|
| |
unfinished module builds should be displayed. This defaults to True.
|
| |
+ :param str owner: list only builds of that user.
|
| |
"""
|
| |
# Don't let the user cause problems by specifying a negative limit
|
| |
if limit < 1:
|
| |
@@ -3540,12 +3541,13 @@
|
| |
states = [build_states['init'], build_states['wait'],
|
| |
build_states['build']]
|
| |
|
| |
- def _get_module_builds(state):
|
| |
+ def _get_module_builds(state, owner=None):
|
| |
"""
|
| |
Private function that is used for multithreading later on to get
|
| |
the desired amount of builds for a specific state.
|
| |
|
| |
:param state: an integer representing the build state to query for
|
| |
+ :param owner: a string; to query for that owner's builds
|
| |
:return: a generator to yield dictionaries of the builds found
|
| |
"""
|
| |
total = 0
|
| |
@@ -3560,6 +3562,8 @@
|
| |
'verbose': True,
|
| |
'per_page': per_page
|
| |
}
|
| |
+ if owner:
|
| |
+ params['owner'] = owner
|
| |
while total < limit:
|
| |
params['page'] = page
|
| |
response = requests.get(baseurl, params=params, timeout=30)
|
| |
@@ -3592,9 +3596,13 @@
|
| |
# Eventually, the MBS should support a range of states but for now, we
|
| |
# have to be somewhat wasteful and query per state
|
| |
module_builds = pool.map(
|
| |
- lambda x: list(_get_module_builds(state=x)), states)
|
| |
+ lambda x: list(_get_module_builds(state=x, owner=owner)), states)
|
| |
# Make one flat list with all the modules
|
| |
module_builds = [item for sublist in module_builds for item in sublist]
|
| |
+ # Sort the list with a secondary key first. It should prevent the situation
|
| |
+ # that two builds with same id (its status was changed during the queries)
|
| |
+ # are in the list and the record with older status is removed.
|
| |
+ module_builds.sort(key=lambda x: x['time_modified'], reverse=True)
|
| |
# Sort the list of builds to be oldest to newest
|
| |
module_builds.sort(key=lambda x: x['id'])
|
| |
# Only grab the desired limit starting from the newest builds
|
| |
Adds additional arguments to command
fedpkg module-overview
:--owner - param is added to mbs query and shows only builds of that owner
--mine - use current Kerberos user (or system username if Kerberos is not present) for filtering
Arguments are mutually exclusive.
JIRA: COMPOSE-3538
Fixes: https://pagure.io/fedpkg/issue/325
Signed-off-by: Ondrej Nosek onosek@redhat.com