1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-26 09:56:13 +01:00

show worker/id on jobhistory and make it faster by adding a default

limit of 20
This commit is contained in:
Adrian Schröter 2009-11-13 13:31:10 +00:00
parent bed57f7684
commit 2e46311ecd
3 changed files with 11 additions and 7 deletions

1
NEWS
View File

@ -22,6 +22,7 @@
- fixed warning messages regarding SSL certificate on some plattforms (Fedora) - fixed warning messages regarding SSL certificate on some plattforms (Fedora)
- support submit requests on project level, osc is checking which packages - support submit requests on project level, osc is checking which packages
have changed and submits only the changed after asking back. 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 # Features which require OBS 1.7
# #

View File

@ -3014,6 +3014,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.option('', '--csv', action='store_true', @cmdln.option('', '--csv', action='store_true',
help='generate output in CSV (separated by |)') help='generate output in CSV (separated by |)')
@cmdln.option('-l', '--limit', metavar='limit',
help='for setting the number of results')
@cmdln.alias('jobhist') @cmdln.alias('jobhist')
def do_jobhistory(self, subcmd, opts, *args): def do_jobhistory(self, subcmd, opts, *args):
"""${cmd_name}: Shows the job history of a project """${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: if opts.csv:
format = '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) @cmdln.hide(1)
def do_rlog(self, subcmd, opts, *args): def do_rlog(self, subcmd, opts, *args):

View File

@ -3514,19 +3514,20 @@ def get_buildhistory(apiurl, prj, package, repository, arch, format = 'text'):
return r 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 import time
if current_package: 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: else:
u = makeurl(apiurl, ['build', prj, repository, arch, '_jobhistory']) u = makeurl(apiurl, ['build', prj, repository, arch, '_jobhistory'], "limit=%d" % (limit) )
f = http_GET(u) f = http_GET(u)
root = ET.parse(f).getroot() root = ET.parse(f).getroot()
if format == 'text': if format == 'text':
print "time package reason code build time" print "time package reason code build time worker"
for node in root.findall('jobhist'): for node in root.findall('jobhist'):
package = node.get('package') package = node.get('package')
worker = node.get('workerid')
reason = node.get('reason') reason = node.get('reason')
if not reason: if not reason:
reason = "unknown" 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) waitbuild = " %2dm %2ds" % (waittm.tm_min, waittm.tm_sec)
if format == 'csv': 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: 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'): def get_commitlog(apiurl, prj, package, revision, format = 'text'):