def work(self, interval=5):

        self.startup()
        cur_job = 0
        while True:
            setproctitle('pyres_minion:%s: waiting for job on: %s' % (os.getppid(),self.queues))
            self.logger.info('waiting on job')
            if self._shutdown:
                self.logger.info('shutdown scheduled')
                break
            self.logger.debug('max_jobs: %d cur_jobs: %d' % (self.max_jobs, cur_job))
            if (self.max_jobs > 0 and self.max_jobs < cur_job):
                self.logger.debug('max_jobs reached on %s: %d' % (self.pid, cur_job))
                self.logger.debug('minion sleeping for: %d secs' % interval)
                time.sleep(interval)
                cur_job = 0
            job = self.reserve()
            if job:
                self.process(job)
                cur_job = cur_job + 1
            else:
                cur_job = 0
                self.logger.debug('minion sleeping for: %d secs' % interval)
                time.sleep(interval)
        self.unregister_minion()
dataset/ETHPy150Open binarydud/pyres/pyres/horde.py/Minion.work/original