def _get_queue_lock(self, queue, log):
        """Get queue lock for max worker queues.

        For max worker queues it returns a Lock if acquired and whether
        it failed to acquire the lock.
        """
        max_workers = self.max_workers_per_queue

        # Check if this is single worker queue
        for part in dotted_parts(queue):
            if part in self.single_worker_queues:
                log.debug('single worker queue')
                max_workers = 1
                break

        # Max worker queues require us to get a queue lock before
        # moving tasks
        if max_workers:
            queue_lock = Semaphore(self.connection,
                                   self._key(LOCK_REDIS_KEY, queue),
                                   self.id, max_locks=max_workers,
                                   timeout=self.config['ACTIVE_TASK_UPDATE_TIMEOUT'])
            acquired, locks = queue_lock.acquire()
            if not acquired:
                return None, True
            log.debug('acquired queue lock', locks=locks)
        else:
            queue_lock = None

        return queue_lock, False
def _get_queue_lock ( self , queue , log ) : max_workers = self . max_workers_per_queue for part in dotted_parts ( queue ) : if part in self . single_worker_queues : log . debug ( 'single worker queue' ) max_workers = 1 break if max_workers : queue_lock = Semaphore ( self . connection , self . _key ( LOCK_REDIS_KEY , queue ) , self . id , max_locks = max_workers , timeout = self . config [ 'ACTIVE_TASK_UPDATE_TIMEOUT' ] ) acquired , locks = queue_lock . acquire ( ) if not acquired : return None , True log . debug ( 'acquired queue lock' , locks = locks ) else : queue_lock = None return queue_lock , False
Get queue lock for max worker queues.

        For max worker queues it returns a Lock if acquired and whether
        it failed to acquire the lock.