Permalink
Browse files

show worktime in session summary + a few minor bugfixes

  • Loading branch information...
1 parent 223ad58 commit 6206d77d08be2129d8eb4f56b77d361d5cafb693 @lirazsiri lirazsiri committed Dec 13, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 cloudtask/logalyzer.py
View
11 cloudtask/logalyzer.py
@@ -168,7 +168,7 @@ def __init__(self, dpath, command):
def fmt_table(rows, title=[], groupby=None):
col_widths = []
for col_index in range(len(rows[0])):
- col = [ str(row[col_index]) for row in rows ]
+ col = [ str(row[col_index]) for row in rows + [title] ]
col_width = max(map(len, col)) + 5
col_widths.append(col_width)
@@ -245,7 +245,7 @@ def header(level, s):
print >> sio, "Efficiency: %d%% (%d work hours vs %d instance hours)" % ((work_hours/float(instance_hours) * 100),
work_hours, instance_hours)
- print >> sio
+ print >> sio
print >> sio, "Configuration:"
print >> sio
@@ -259,7 +259,7 @@ def header(level, s):
fields = conf
fields['workers'] = workers
- for field in ('command', 'workers', 'backup_id', 'overlay', 'post', 'pre', 'timeout', 'report', '', 'workers'):
+ for field in ('command', 'backup_id', 'overlay', 'post', 'pre', 'timeout', 'report', '', 'workers'):
if not field:
print >> sio
elif field in fields and fields[field]:
@@ -273,19 +273,20 @@ def header(level, s):
rows = []
for worker in workers:
worker_id = worker.worker_id
- if not worker.instancetime:
+ if worker.instanceid and not worker.instancetime:
worker_id = "%d\t# NOT DESTROYED!" % worker_id
def fN(v):
return v if v is not None else '-'
row = [ worker.jobs,
+ fmt_elapsed(worker.worktime) if worker.worktime else '-',
fmt_elapsed(worker.instancetime) if worker.instancetime else '-',
worker.instanceid if worker.instanceid else '-',
worker_id ]
rows.append(row)
- fmted_table = fmt_table(rows, ["JOBS", "LIFETIME", "INSTANCE", "WORKER"])
+ fmted_table = fmt_table(rows, ["JOBS", "WORKTIME", "LIFETIME", "INSTANCE", "WORKER"])
print >> sio, indent(8, fmted_table) + "\n"
if stats.pending:

0 comments on commit 6206d77

Please sign in to comment.