code: def _process_from_queue(self, queue):
          
          now = time.time()
  
          log = self.log.bind(queue=queue)
  
          batch_size = self._get_queue_batch_size(queue)
  
          queue_lock, failed_to_acquire = self._get_queue_lock(queue, log)
          if failed_to_acquire:
              return [], -1
  
          # Move an item to the active queue, if available.
          # We need to be careful when moving unique tasks: We currently don't
          # support concurrent processing of multiple unique tasks. If the task
          # is already in the ACTIVE queue, we need to execute the queued task
          # later, i.e. move it to the SCHEDULED queue (prefer the earliest
          # time if it's already scheduled). We want to make sure that the last
          # queued instance of the task always gets executed no earlier than it
          # was queued.
          later = time.time() + self.config['LOCK_RETRY']
  
          task_ids = self.scripts.zpoppush(
              self._key(QUEUED, queue),
              self._key(ACTIVE, queue),
              batch_size,
              None,
              now,
              if_exists=('add', self._key(SCHEDULED, queue), later, 'min'),
              on_success=('update_sets', queue, self._key(QUEUED),
                          self._key(ACTIVE), self._key(SCHEDULED))
          )
          log.debug('moved tasks', src_queue=QUEUED, dest_queue=ACTIVE,
                    qty=len(task_ids))
  
          processed_count = 0
          if task_ids:
              processed_count = self._process_queue_tasks(queue, queue_lock,
                                                          task_ids, now, log)
  
          if queue_lock:
              queue_lock.release()
              log.debug('released swq lock')
  
          return task_ids, processed_count
docs: Internal method to process a task batch from the given queue.
  
          Args:
              queue: Queue name to be processed
  
          Returns:
              Task IDs:   List of tasks that were processed (even if there was an
                          error so that client code can assume the queue is empty
                          if nothing was returned)
              Count:      The number of tasks that were attempted to be executed or
                          -1 if the queue lock couldn't be acquired.