rq_scheduler/scheduler.py
def run(self, burst=False):
        """
        Periodically check whether there's any job that should be put in the queue (score
        lower than current time).
        """

        self.register_birth()
        self._install_signal_handlers()

        try:
            while True:
                self.log.debug("Entering run loop")
                self.heartbeat()

                start_time = time.time()
                if self.acquire_lock():
                    self.log.debug('{}: Acquired Lock'.format(self.key))
                    self.enqueue_jobs()
                    self.heartbeat()
                    self.remove_lock()

                    if burst:
                        self.log.info('RQ scheduler done, quitting')
                        break
                else:
                    self.log.warning('Lock already taken - skipping run')

                # Time has already elapsed while enqueuing jobs, so don't wait too long.
                seconds_elapsed_since_start = time.time() - start_time
                seconds_until_next_scheduled_run = self._interval - seconds_elapsed_since_start
                # ensure we have a non-negative number
                if seconds_until_next_scheduled_run > 0:
                    self.log.debug("Sleeping %.2f seconds" % seconds_until_next_scheduled_run)
                    time.sleep(seconds_until_next_scheduled_run)
        finally:
            self.remove_lock()
            self.register_death()

        Periodically check whether there's any job that should be put in the queue (score
        lower than current time).
        
Periodically check whether there's any job that should be put in the queue (score
lower than current time).
Periodically check whether there ' s any job that should be put in the queue ( score lower than current time ) .
def run(self, burst=False):
        self.register_birth()
        self._install_signal_handlers()
        try:
            while True:
                self.log.debug("Entering run loop")
                self.heartbeat()
                start_time = time.time()
                if self.acquire_lock():
                    self.log.debug('{}: Acquired Lock'.format(self.key))
                    self.enqueue_jobs()
                    self.heartbeat()
                    self.remove_lock()
                    if burst:
                        self.log.info('RQ scheduler done, quitting')
                        break
                else:
                    self.log.warning('Lock already taken - skipping run')
                seconds_elapsed_since_start = time.time() - start_time
                seconds_until_next_scheduled_run = self._interval - seconds_elapsed_since_start
                if seconds_until_next_scheduled_run > 0:
                    self.log.debug("Sleeping %.2f seconds" % seconds_until_next_scheduled_run)
                    time.sleep(seconds_until_next_scheduled_run)
        finally:
            self.remove_lock()
            self.register_death()
def run ( self , burst = False ) : self . register_birth ( ) self . _install_signal_handlers ( ) try : while True : self . log . debug ( "Entering run loop" ) self . heartbeat ( ) start_time = time . time ( ) if self . acquire_lock ( ) : self . log . debug ( '{}: Acquired Lock' . format ( self . key ) ) self . enqueue_jobs ( ) self . heartbeat ( ) self . remove_lock ( ) if burst : self . log . info ( 'RQ scheduler done, quitting' ) break else : self . log . warning ( 'Lock already taken - skipping run' ) seconds_elapsed_since_start = time . time ( ) - start_time seconds_until_next_scheduled_run = self . _interval - seconds_elapsed_since_start if seconds_until_next_scheduled_run > 0 : self . log . debug ( "Sleeping %.2f seconds" % seconds_until_next_scheduled_run ) time . sleep ( seconds_until_next_scheduled_run ) finally : self . remove_lock ( ) self . register_death ( )
Periodically check whether there's any job that should be put in the queue (score
lower than current time).
Periodically check whether there ' s any job that should be put in the queue ( score lower than current time ) .
"""
        Periodically check whether there's any job that should be put in the queue (score
        lower than current time).
        """ # Time has already elapsed while enqueuing jobs, so don't wait too long. # ensure we have a non-negative number
self
burst