ut: cli - watch_tasks with KeyboardInterrupt
change display_tasklist_status() to _display_tasklist_status()
display_task_results() to _display_task_results()
This commit is contained in:
parent
2da05e9e59
commit
cab2b2ee69
2 changed files with 150 additions and 93 deletions
9
cli/koji
9
cli/koji
|
|
@ -394,7 +394,7 @@ class TaskWatcher(object):
|
|||
else:
|
||||
return koji.TASK_STATES[info['state']].lower()
|
||||
|
||||
def display_tasklist_status(tasks):
|
||||
def _display_tasklist_status(tasks):
|
||||
free = 0
|
||||
open = 0
|
||||
failed = 0
|
||||
|
|
@ -411,7 +411,7 @@ def display_tasklist_status(tasks):
|
|||
free += 1
|
||||
print " %d free %d open %d done %d failed" % (free, open, done, failed)
|
||||
|
||||
def display_task_results(tasks):
|
||||
def _display_task_results(tasks):
|
||||
for task in [task for task in tasks.values() if task.level == 0]:
|
||||
state = task.info['state']
|
||||
task_label = task.str()
|
||||
|
|
@ -448,7 +448,7 @@ def watch_tasks(session,tasklist,quiet=False):
|
|||
if changed:
|
||||
# task is done and state just changed
|
||||
if not quiet:
|
||||
display_tasklist_status(tasks)
|
||||
_display_tasklist_status(tasks)
|
||||
if not task.is_success():
|
||||
rv = 1
|
||||
for child in session.getTaskChildren(task_id):
|
||||
|
|
@ -462,7 +462,7 @@ def watch_tasks(session,tasklist,quiet=False):
|
|||
if all_done:
|
||||
if not quiet:
|
||||
print
|
||||
display_task_results(tasks)
|
||||
_display_task_results(tasks)
|
||||
break
|
||||
|
||||
sys.stdout.flush()
|
||||
|
|
@ -476,6 +476,7 @@ def watch_tasks(session,tasklist,quiet=False):
|
|||
"""Tasks still running. You can continue to watch with the '%s watch-task' command.
|
||||
Running Tasks:
|
||||
%s""" % (progname, '\n'.join(tlist))
|
||||
sys.stdout.flush()
|
||||
rv = 1
|
||||
return rv
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue