Skip to content

Commit 7440813

Browse files
committed
Add reporting of task number
1 parent 6a9eb36 commit 7440813

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

bin/webdevops/doit/DoitReporter.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ class DoitReporter(object):
9999

100100
show_out = False
101101
show_err = False
102+
task_finished = 0
103+
task_total = 0
102104

103105
def __init__(self, outstream, options=None): #pylint: disable=W0613
104106
# result is sent to stdout when doit finishes running
@@ -130,15 +132,19 @@ def execute_task(self, task):
130132
"""
131133
self.t_results[task.name].start()
132134

135+
133136
def add_failure(self, task, exception):
134137
"""
135138
called when excution finishes with a failure
136139
"""
137140
self.t_results[task.name].set_result('fail', exception.get_msg())
138141

142+
self.task_finished += 1
143+
139144
if task.actions and (task.name[0] != '_'):
140145
duration = self.duration(self.t_results[task.name].elapsed)
141-
self.writeln(colored('. %s FAILED (%s)' % (BaseTaskLoader.human_task_name(task.title()), duration), 'red'))
146+
progress = self.calc_progress()
147+
self.writeln(colored('. %s FAILED (%s, #%s)' % (BaseTaskLoader.human_task_name(task.title()), duration, progress), 'red'))
142148
self.failures.append({'task': task, 'exception': exception})
143149

144150
def add_success(self, task):
@@ -147,9 +153,12 @@ def add_success(self, task):
147153
"""
148154
self.t_results[task.name].set_result('success')
149155

156+
self.task_finished += 1
157+
150158
if task.actions and (task.name[0] != '_'):
151159
duration = self.duration(self.t_results[task.name].elapsed)
152-
self.writeln(colored('. %s finished (%s)' % (BaseTaskLoader.human_task_name(task.title()), duration), 'green'))
160+
progress = self.calc_progress()
161+
self.writeln(colored('. %s finished (%s, %s)' % (BaseTaskLoader.human_task_name(task.title()), duration, progress), 'green'))
153162

154163
def skip_uptodate(self, task):
155164
"""
@@ -283,6 +292,9 @@ def duration(self, duration):
283292
"""
284293
return 'duration: %s' % str(datetime.timedelta(seconds=int(duration)))
285294

295+
def calc_progress(self):
296+
return 'task #%s' % (self.task_finished)
297+
286298
def writeln(self, text=''):
287299
"""
288300
Output

0 commit comments

Comments
 (0)