mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-26 01:46:13 +01:00
show worker/id on jobhistory and make it faster by adding a default
limit of 20
This commit is contained in:
parent
bed57f7684
commit
2e46311ecd
1
NEWS
1
NEWS
@ -22,6 +22,7 @@
|
||||
- fixed warning messages regarding SSL certificate on some plattforms (Fedora)
|
||||
- support submit requests on project level, osc is checking which packages
|
||||
have changed and submits only the changed after asking back.
|
||||
- show worker/id on jobhistory and make it faster by adding a default limit of 20
|
||||
#
|
||||
# Features which require OBS 1.7
|
||||
#
|
||||
|
@ -3014,6 +3014,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
|
||||
@cmdln.option('', '--csv', action='store_true',
|
||||
help='generate output in CSV (separated by |)')
|
||||
@cmdln.option('-l', '--limit', metavar='limit',
|
||||
help='for setting the number of results')
|
||||
@cmdln.alias('jobhist')
|
||||
def do_jobhistory(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: Shows the job history of a project
|
||||
@ -3058,7 +3060,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if opts.csv:
|
||||
format = 'csv'
|
||||
|
||||
print_jobhistory(apiurl, project, package, repository, arch, format)
|
||||
print_jobhistory(apiurl, project, package, repository, arch, format, int(opts.limit or 20))
|
||||
|
||||
@cmdln.hide(1)
|
||||
def do_rlog(self, subcmd, opts, *args):
|
||||
|
13
osc/core.py
13
osc/core.py
@ -3514,19 +3514,20 @@ def get_buildhistory(apiurl, prj, package, repository, arch, format = 'text'):
|
||||
|
||||
return r
|
||||
|
||||
def print_jobhistory(apiurl, prj, current_package, repository, arch, format = 'text'):
|
||||
def print_jobhistory(apiurl, prj, current_package, repository, arch, format = 'text', limit=20):
|
||||
import time
|
||||
if current_package:
|
||||
u = makeurl(apiurl, ['build', prj, repository, arch, '_jobhistory'], "package=%s" % (current_package))
|
||||
u = makeurl(apiurl, ['build', prj, repository, arch, '_jobhistory'], "package=%s&limit=%d" % (current_package, limit))
|
||||
else:
|
||||
u = makeurl(apiurl, ['build', prj, repository, arch, '_jobhistory'])
|
||||
u = makeurl(apiurl, ['build', prj, repository, arch, '_jobhistory'], "limit=%d" % (limit) )
|
||||
f = http_GET(u)
|
||||
root = ET.parse(f).getroot()
|
||||
|
||||
if format == 'text':
|
||||
print "time package reason code build time"
|
||||
print "time package reason code build time worker"
|
||||
for node in root.findall('jobhist'):
|
||||
package = node.get('package')
|
||||
worker = node.get('workerid')
|
||||
reason = node.get('reason')
|
||||
if not reason:
|
||||
reason = "unknown"
|
||||
@ -3548,9 +3549,9 @@ def print_jobhistory(apiurl, prj, current_package, repository, arch, format = 't
|
||||
waitbuild = " %2dm %2ds" % (waittm.tm_min, waittm.tm_sec)
|
||||
|
||||
if format == 'csv':
|
||||
print '%s|%s|%s|%s|%s' % (endtime, package, reason, code, waitbuild)
|
||||
print '%s|%s|%s|%s|%s|%s' % (endtime, package, reason, code, waitbuild, worker)
|
||||
else:
|
||||
print '%s %-50s %-16s %-16s %s' % (endtime, package[0:49], reason[0:15], code[0:15], waitbuild)
|
||||
print '%s %-50s %-16s %-16s %-16s %-16s' % (endtime, package[0:49], reason[0:15], code[0:15], waitbuild, worker)
|
||||
|
||||
|
||||
def get_commitlog(apiurl, prj, package, revision, format = 'text'):
|
||||
|
Loading…
Reference in New Issue
Block a user