class ProgressMonitor(ThreadMonitor): """ Class ProgressMonitor monitors pypy process while it is running and reports progress """ def __init__(self, pypy): super(ProgressMonitor, self).__init__(pypy) # set priority so that output is right after is finished and overrides # previous progress bar line self.pypy.on_process_complete.set_priority(self.on_complete, 5) self.timer = ProgressTime('Running | elapsed time {}') @ensure_active def on_update(self, pypy=None): if pypy.executor.broken: return self.timer.update() @ensure_active def on_complete(self, pypy=None): if pypy.executor.broken: return self.timer.format = 'Done | elapsed time {}' self.timer.stop()
class ProgressMonitor(ThreadMonitor): def __init__(self, pypy): super(ProgressMonitor, self).__init__(pypy) self.timer = ProgressTime('Running | elapsed time {}') # increase priority self.pypy.on_process_complete.set_priority(self.on_complete, 5) @ensure_active def on_update(self, pypy=None): self.timer.update() @ensure_active def on_complete(self, pypy=None): self.timer.format = 'Done | elapsed time {}' self.timer.stop()
def __init__(self, pypy): super(ProgressMonitor, self).__init__(pypy) # set priority so that output is right after is finished and overrides # previous progress bar line self.pypy.on_process_complete.set_priority(self.on_complete, 5) self.timer = ProgressTime('Running | elapsed time {}')
def __init__(self, pypy): super(ProgressMonitor, self).__init__(pypy) self.timer = ProgressTime('Running | elapsed time {}') # increase priority self.pypy.on_process_complete.set_priority(self.on_complete, 5)