Skip to content

Commit 881fec1

Browse files
committed
Show task progress in doit
1 parent 7440813 commit 881fec1

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

bin/webdevops/doit/DoitReporter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ def duration(self, duration):
293293
return 'duration: %s' % str(datetime.timedelta(seconds=int(duration)))
294294

295295
def calc_progress(self):
296-
return 'task #%s' % (self.task_finished)
296+
percentage = 100 * float(self.task_finished)/float(BaseTaskLoader.TASK_COUNT)
297+
return 'task %s/%s, progress %d%%' % (self.task_finished, BaseTaskLoader.TASK_COUNT, percentage)
297298

298299
def writeln(self, text=''):
299300
"""

bin/webdevops/taskloader/BaseTaskLoader.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@
2323
from doit.cmd_base import TaskLoader
2424
from doit.task import dict_to_task
2525

26+
2627
class BaseTaskLoader(TaskLoader):
2728
configuration = False
29+
reporter = False
30+
TASK_COUNT = 0
2831

2932
def __init__(self, configuration):
3033
"""
@@ -33,7 +36,6 @@ def __init__(self, configuration):
3336
# Build configuration as namespace object
3437
self.configuration = configuration
3538

36-
3739
def process_tasklist(self, tasklist):
3840
"""
3941
Process task list and create task objects
@@ -44,6 +46,8 @@ def process_tasklist(self, tasklist):
4446

4547
print 'Starting execution of %s tasks...' % (len(ret))
4648

49+
BaseTaskLoader.TASK_COUNT = len(ret)
50+
4751
return ret
4852

4953

0 commit comments

Comments
 (0)