def run(self):
      try:
        while 1:
          with self.condition:
            if not len(self.tasks):
              self.condition.wait(self.idle_timeout)
            try:
              task = self.tasks.popleft()
            except __HOLE__:
              logging.debug('Idle timeout: %s' % self.name)
              self.threads.remove(self)
              self.in_use = False
              return
          try:
            task[0](*task[1], **task[2])
          except Exception as e:
            logging.error(traceback.format_exc())
      finally:
        with self.condition:
          if self.in_use:
            self.threads.remove(self)
            self.in_use = False
dataset/ETHPy150Open JeremyOT/Toto/toto/tasks.py/TaskQueue.__TaskLoop.run