def _unregister(self, conn): with self.cv: try: stats = self.conns.pop(conn) except KeyError: stats = None else: self.cv.notifyAll() if stats is not None and stats['active']: self.last_disconnect_time = time.time() active = self.active_clients() logger.info( '[%s] Active client disconnected (sent %d messages). Still have %d active clients left', utils.thread_name(), stats['messages'], len(active)) else: logger.info('[%s] Non-active client disconnected', utils.thread_name()) self.control_buffer.client_disconnect(conn, stats)
def _log(self): if 'rewarder.profile' in self.info: self.info['rewarder.profile'] = '<{} bytes>'.format(len(str(self.info['rewarder.profile']))) if len(self.reward) > 0: min_reward = min(self.reward) max_reward = max(self.reward) else: min_reward = '(empty)' max_reward = '(empty)' logger.info('[%s] Over past %.2fs, sent %s reward messages to agent: reward=%s reward_min=%s reward_max=%s done=%s info=%s', utils.thread_name(), time.time() - self.last_print, self.count, sum(self.reward), min_reward, max_reward, self.done, self.info)
def _log_reset(self): logger.info('[%s] Ending previous episode: episode_reward=%s episode_count=%s episode_duration=%.2f', utils.thread_name(), self.episode_reward, self.episode_count, time.time() - self.episode_start)