Processes queued item of type pull
425163
def process_pull
      factory = "::#{object_type}".constantize
      syncer = factory.synchronizer
      syncer.pull_object(self.object_remote_id)
      
      self.state = 'done'
      self.save
    end
921896
def process(self):
        """"""
        if WINDOWS:
            select_inputs = []
            for i in self.inputs:
                if not isinstance(i, SelectableObject):
                    warning("Unknown ignored object type: %s", type(i))
                elif i.__selectable_force_select__:
                    # Then use select.select
                    select_inputs.append(i)
                elif not self.remain and i.check_recv():
                    self.results.append(i)
                else:
                    i.wait_return(self._exit_door)
            if select_inputs:
                # Use default select function
                self.results.extend(select(select_inputs, [], [], self.remain)[0])  # noqa: E501
            if not self.remain:
                return self.results

            threading.Thread(target=self._timeout_thread, args=(self.remain,)).start()  # noqa: E501
            if not self._ended:
                self.available_lock.acquire()
            return self.results
        else:
            r, _, _ = select(self.inputs, [], [], self.remain)
            return r
278518
def process_events(self):
        """"""
        for event, args in iter_except(self.event_queue.popleft, IndexError):
            for callback in self.event_callbacks[event]:
                callback(*args)
1150640
function processItemAsync(runner, currentValidation, key, context) {
  return Promise.resolve(true).then(function() {
    return processItem(runner, currentValidation, key, context)
  });
}
476146
function _pull(job) {
    logger.silly(`Pulling ${job.id}`);
    job.stderr().then((streamError) => {
        let stderrString = null;
        streamError.on('data', function (datum) {
            stderrString = stderrString ? stderrString + datum.toString() : datum.toString();
        })
            .on('end', function () {
            if (!stderrString) {
                _storeAndEmit(job.id);
                return;
            }
            logger.warn(`Job ${job.id} delivered a non empty stderr stream\n${stderrString}`);
            job.ERR_jokers--;
            if (job.ERR_jokers > 0) {
                console.log(`Resubmitting this job ${job.ERR_jokers} try left`);
                job.resubmit();
                liveMemory.setCycle({ jobObject: job }, 0);
            }
            else {
                console.log("This job will be set in error state");
                _storeAndEmit(job.id, 'error');
            }
        });
    });
}
1254525
def pull(self):
        
        sock = self.__sock(zmq.PULL)
        return self.__recv_generator(sock)
145805
def process_items(r, keys, timeout, limit=0, log_every=1000, wait=.1):
    
    limit = limit or float('inf')
    processed = 0
    while processed < limit:
        # Change ``blpop`` to ``brpop`` to process as LIFO.
        ret = r.blpop(keys, timeout)
        # If data is found before the timeout then we consider we are done.
        if ret is None:
            time.sleep(wait)
            continue

        source, data = ret
        try:
            item = json.loads(data)
        except Exception:
            logger.exception("Failed to load item:\n%r", pprint.pformat(data))
            continue

        try:
            name = item.get('name') or item.get('title')
            url = item.get('url') or item.get('link')
            logger.debug("[%s] Processing item: %s <%s>", source, name, url)
        except KeyError:
            logger.exception("[%s] Failed to process item:\n%r",
                             source, pprint.pformat(item))
            continue

        processed += 1
        if processed % log_every == 0:
            logger.info("Processed %s items", processed)
110079
function processItemprop(item, processedItems) {
  var property, value, itemtypeHtml, currentItem;

  itemtypeHtml = $(item).parents("[itemtype]").html();

  if (itemtypeHtml) {
    property = $(item).attr('itemprop');
    value    = getPropValue(item);

    currentItem   = arraySearch(processedItems, md5(itemtypeHtml));

    if (currentItem.properties[property]) {
      if (!Array.isArray(currentItem.properties[property])) {
        currentItem.properties[property] = [currentItem.properties[property]];
      }
      currentItem.properties[property].push(value);
    } else {
      currentItem.properties[property] = value;
    }
  }
}
10366
def process_queue_item      #:nodoc:
      return false if @queue.empty?

      # Even though we just asked if the queue was empty, it
      # still could have had an item which by this statement
      # is now gone. For this reason we pass true to Queue#deq
      # because we will sleep indefinitely if it is empty.
      promise = @queue.deq(true)
      stat :dequeued, item_id: promise.object_id
      promise.work
      return true

    rescue ThreadError # this means the queue is empty
      false
    end
1222415
private void fillQueue(QueueItem item, Integer minStartPosition,
      Integer maxStartPosition, Integer minEndPosition) throws IOException {
    int newStartPosition;
    int newEndPosition;
    Integer firstRetrievedPosition = null;
    // remove everything below minStartPosition
    if ((minStartPosition != null) && (item.lowestPosition != null)
        && (item.lowestPosition < minStartPosition)) {
      item.del((minStartPosition - 1));
    }
    // fill queue
    while (!item.noMorePositions) {
      boolean doNotCollectAnotherPosition;
      doNotCollectAnotherPosition = item.filledPosition
          && (minStartPosition == null) && (maxStartPosition == null);
      doNotCollectAnotherPosition |= item.filledPosition
          && (maxStartPosition != null) && (item.lastRetrievedPosition != null)
          && (maxStartPosition < item.lastRetrievedPosition);
      if (doNotCollectAnotherPosition) {
        return;
      } else {
        // collect another full position
        firstRetrievedPosition = null;
        while (!item.noMorePositions) {
          newStartPosition = item.sequenceSpans.spans.nextStartPosition();
          if (newStartPosition == NO_MORE_POSITIONS) {
            if (!item.queue.isEmpty()) {
              item.filledPosition = true;
              item.lastFilledPosition = item.lastRetrievedPosition;
            }
            item.noMorePositions = true;
            return;
          } else if ((minStartPosition != null)
              && (newStartPosition < minStartPosition)) {
            // do nothing
          } else {
            newEndPosition = item.sequenceSpans.spans.endPosition();
            if ((minEndPosition == null) || (newEndPosition >= minEndPosition
                - ignoreItem.getMinStartPosition(docId, newEndPosition))) {
              item.add(newStartPosition, newEndPosition);
              if (firstRetrievedPosition == null) {
                firstRetrievedPosition = newStartPosition;
              } else if (!firstRetrievedPosition.equals(newStartPosition)) {
                break;
              }
            }
          }
        }
      }
    }
  }
1220669
@SuppressWarnings ({ "rawtypes", "unchecked" })
    private final void processQueue () {

        SoftValue<V> softValue;
        while ((softValue = (SoftValue) queue.poll()) != null) {
            internalMap.remove(softValue.key);
        }
    }
948072
function afterProcessReq(request, response) {
    defaults.afterExecuteOfflineItem(response, request.payload);
    return processReqs(utils.storage.get('queue'));
  }
661126
def pass_result(db: JobDB, always_cache=False):
    """"""
    @pull
    def pass_result_stream(worker_source):
        """Pull stream instance created by `pass_result`."""
        for result in worker_source():
            if result is EndOfQueue:
                return

            attached = db.store_result_in_db(
                result, always_cache=always_cache)

            yield result
            yield from (ResultMessage(key, 'attached', result.value, None)
                        for key in attached)

    return pass_result_stream
614554
protected void processLinkQueue()
    {
        long timeout = this.configuration.getCheckTimeout();
        List<Pattern> excludedReferencePatterns = this.configuration.getExcludedReferencePatterns();

        // Unqueue till we find an item that needs to be processed. We process an item if:
        // - it isn't present in the state map
        // - it is present but not enough time has elapsed since its last check time
        LinkQueueItem queueItem = null;
        boolean shouldBeChecked = false;

        while (!this.linkQueue.isEmpty() && !shouldBeChecked) {
            queueItem = this.linkQueue.poll();

            // Don't check excluded references
            shouldBeChecked = isExcluded(queueItem.getContentReference(), excludedReferencePatterns);
            if (!shouldBeChecked) {
                break;
            }

            Map<String, LinkState> contentReferences =
                this.linkStateManager.getLinkStates().get(queueItem.getLinkReference());
            if (contentReferences != null) {
                LinkState state = contentReferences.get(queueItem.getContentReference());
                if (state != null && (System.currentTimeMillis() - state.getLastCheckedTime() <= timeout)) {
                    shouldBeChecked = false;
                }
            }
        }

        if (shouldBeChecked && queueItem != null) {
            checkLink(queueItem);
        }
    }
305135
def popitem(self):
        """"""
        pq = self.pq
        while pq:
            priority, key, val = heapq.heappop(pq)
            if val is None:
                self.removed_count -= 1

            else:
                del self.item_finder[key]
                return key, val, priority

        raise KeyError("pop from an empty priority queue")
427500
def _run_queued_callbacks(self):
        '''  '''
        for callback in self._queued_callbacks:
            try:
                callback()
            except Exception as ex:
                logger.error("Exception: %s" % str(ex))
824701
def done(item, done_type=None, max_tries=None, ttl=None):
    ''''''
    if done_type is None or done_type == _c.FSQ_SUCCESS:
        return success(item)
    return fail(item, fail_type=done_type, max_tries=max_tries, ttl=ttl)