def wait(self, ignore_old_errors=False): idle, now, status_stacks, current, last_time = self._server_idle( 0, ignore_errors=ignore_old_errors) if idle: return if current: t0 = current[0] else: t0 = now waited = int(round(now - t0)) - 1 if self.verbose == 'dots': print('[' + '.' * waited, end=' ') while not idle: if self.siginfo_check(): print() print_status_stacks(status_stacks) waited += 1 if waited % 60 == 0 and self.monitor: self.monitor.ping() if self.verbose: if current: current = ( now - t0, current[1], now - current[2], ) else: current = ( now - t0, self.job_method, 0, ) if self.verbose == 'dots': if waited % 60 == 0: sys.stdout.write('[%d]\n ' % (now - t0, )) else: sys.stdout.write('.') elif self.verbose == 'log': if waited % 60 == 0: print('%d seconds, still waiting for %s (%d seconds)' % current) else: current_display = ( fmttime(current[0], True), current[1], fmttime(current[2], True), ) sys.stdout.write('\r\033[K %s %s %s' % current_display) idle, now, status_stacks, current, last_time = self._server_idle(1) if self.verbose == 'dots': print('(%d)]' % (last_time, )) elif self.verbose: print('\r\033[K %s' % (fmttime(last_time), ))
def siginfo(sig, frame): print_status_stacks()