Skip to content

Commit

Permalink
Merge pull request #25628 from alprs/fix-highstate_duration_output
Browse files Browse the repository at this point in the history
Highstate output: show duration in seconds instead of milliseconds when appropriate
  • Loading branch information
Mike Place committed Jul 22, 2015
2 parents 2685953 + 4fd4a0c commit 9004ce2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion salt/output/highstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,15 @@ def _counts(label, count):
sum(six.itervalues(rcounts)) - rcounts.get('warnings', 0),
line_max_len - 7)
hstrs.append(colorfmt.format(colors['CYAN'], totals, colors))
total_duration = u'Total run time: {0:>{1}} ms'.format(sum(rdurations), line_max_len - 7)

sum_duration = sum(rdurations)
duration_unit = 'ms'
# convert to seconds if duration is 1000ms or more
if sum_duration > 999:
sum_duration /= 1000
duration_unit = 's'
total_duration = u'Total run time: {0:>{1}} {2}'.format(
sum_duration, line_max_len - 7, duration_unit)
hstrs.append(colorfmt.format(colors['CYAN'], total_duration, colors))

if strip_colors:
Expand Down

0 comments on commit 9004ce2

Please sign in to comment.