Skip to content
Permalink
Browse files

fix: fix route table total time

  • Loading branch information...
hanxiao committed Sep 23, 2019
1 parent 6a6797e commit 402867cc5b92d0a0b07de993524f6553b6952adb
Showing with 7 additions and 6 deletions.
  1. +7 −6 gnes/client/cli.py
@@ -84,13 +84,13 @@ def __init__(self, bar_len: int = 20, task_name: str = ''):
self.task_name = task_name

def update(self):
sys.stdout.write('\r')
self.num_bars += 1
if (self.num_bars + 1) % self.bar_len == 0:
sys.stdout.write('\n')
elapsed = time.perf_counter() - self.start_time
elapsed_str = colored('elapsed', 'yellow')
speed_str = colored('speed', 'yellow')
self.num_bars += 1
if self.num_bars % self.bar_len == 0:
sys.stdout.write('\n')

sys.stdout.write(
'{:>10} [{:<{}}] {:>8}: {:3.1f}s {:>8}: {:3.1f} batch/s'.format(
colored(self.task_name, 'cyan'),
@@ -101,12 +101,13 @@ def update(self):
speed_str,
self.num_bars / elapsed,
))

sys.stdout.flush()
sys.stdout.write('\r')

def __enter__(self):
self.start_time = time.perf_counter()
self.num_bars = -1
sys.stdout.write('\n')
self.num_bars = 0
self.update()
return self

0 comments on commit 402867c

Please sign in to comment.
You can’t perform that action at this time.