Checks if a pending request can be fulfilled.
483195
private void checkPendingRequests() {

		final Iterator<Map.Entry<JobID, PendingRequestsMap>> it = this.pendingRequestsOfJob.entrySet().iterator();
		while (it.hasNext()) {

			final List<AllocatedResource> allocatedResources = new ArrayList<AllocatedResource>();
			final Map.Entry<JobID, PendingRequestsMap> entry = it.next();
			final JobID jobID = entry.getKey();
			final PendingRequestsMap pendingRequestsMap = entry.getValue();
			final Iterator<Map.Entry<InstanceType, Integer>> it2 = pendingRequestsMap.iterator();
			while (it2.hasNext()) {

				final Map.Entry<InstanceType, Integer> entry2 = it2.next();
				final InstanceType requestedInstanceType = entry2.getKey();
				int numberOfPendingInstances = entry2.getValue().intValue();

				// Consistency check
				if (numberOfPendingInstances <= 0) {
					LOG.error("Inconsistency: Job " + jobID + " has " + numberOfPendingInstances
						+ " requests for instance type " + requestedInstanceType.getIdentifier());
					continue;
				}

				while (numberOfPendingInstances > 0) {

					if (LOG.isDebugEnabled()) {
						LOG.debug("Trying to allocate instance of type " + requestedInstanceType.getIdentifier());
					}

					// TODO: Introduce topology awareness here
					final AllocatedSlice slice = getSliceOfType(jobID, requestedInstanceType);
					if (slice == null) {
						break;
					} else {

						LOG.info("Allocated instance of type " + requestedInstanceType.getIdentifier()
							+ " as a result of pending request for job " + jobID);

						// Decrease number of pending instances
						--numberOfPendingInstances;
						pendingRequestsMap.decreaseNumberOfPendingInstances(requestedInstanceType);

						List<AllocatedSlice> allocatedSlices = this.slicesOfJobs.get(jobID);
						if (allocatedSlices == null) {
							allocatedSlices = new ArrayList<AllocatedSlice>();
							this.slicesOfJobs.put(jobID, allocatedSlices);
						}
						allocatedSlices.add(slice);

						allocatedResources.add(new AllocatedResource(slice.getHostingInstance(), slice.getType(), slice
							.getAllocationID()));
					}
				}
			}

			if (!allocatedResources.isEmpty() && this.instanceListener != null) {

				final ClusterInstanceNotifier clusterInstanceNotifier = new ClusterInstanceNotifier(
					this.instanceListener, jobID, allocatedResources);

				clusterInstanceNotifier.start();
			}
		}
	}
341418
def _check_reply_pending(self, option):
        """"""
        if not self.telnet_opt_dict.has_key(option):
            self.telnet_opt_dict[option] = TelnetOption()
        return self.telnet_opt_dict[option].reply_pending
725774
async def pendings(self, tasks=None):
        
        tasks = tasks or self.todo_tasks
        await asyncio.gather(*tasks, loop=self.loop)
253970
def is_available(self) -> bool:
        """"""
        status_response = self.get_state(
            'api/host/daemonCheck.json'
        )

        if not status_response:
            return False

        return status_response.get('result') == 1
1092863
private void cancelPendingSlotRequest(PendingSlotRequest pendingSlotRequest) {
		CompletableFuture<Acknowledge> request = pendingSlotRequest.getRequestFuture();

		returnPendingTaskManagerSlotIfAssigned(pendingSlotRequest);

		if (null != request) {
			request.cancel(false);
		}
	}
126909
def isAvailable(self, requester, access):
        
        debuglog("%s isAvailable(%s, %s): self.owners=%r"
                 % (self, requester, access, self.owners))
        num_excl, num_counting = self._claimed_excl, self._claimed_counting

        # Find all waiters ahead of the requester in the wait queue
        for idx, waiter in enumerate(self.waiting):
            if waiter[0] is requester:
                w_index = idx
                break
        else:
            w_index = len(self.waiting)
        ahead = self.waiting[:w_index]

        if access.mode == 'counting':
            # Wants counting access
            return num_excl == 0 and num_counting + len(ahead) < self.maxCount \
                and all([w[1].mode == 'counting' for w in ahead])
        # else Wants exclusive access
        return num_excl == 0 and num_counting == 0 and not ahead
523706
function () {
				if (q) {
					for (var i = 0, len = arguments.length; i < len; i++) {
						q.push(arguments[i]);
						if (!q.pending) {
							doNext.apply({}, q.args || []);
						}
					}
				}
				return me;
			}
1212704
def is_capable(cls, requested_capability):
        
        for c in requested_capability:
            if not c in cls.capability:
                return False
        return True
1001912
def ps(ui, repo, *pats, **opts):
	
	opts['short'] = True
	return pending(ui, repo, *pats, **opts)
673580
private void sendPending() {
    while (outstanding.get() < concurrency) {
      final TopicQueue queue = pendingTopics.poll();
      if (queue == null) {
        return;
      }

      queue.pending = false;
      final int sent = queue.sendBatch();

      // Did we send a whole batch? Then there might be more messages in the queue. Mark as pending again.
      if (sent == batchSize) {
        queue.pending = true;
        pendingTopics.offer(queue);
      }
    }
  }
998042
def pending():
    """"""

    signalbus = current_app.extensions['signalbus']
    pending = []
    total_pending = 0
    for signal_model in signalbus.get_signal_models():
        count = signal_model.query.count()
        if count > 0:
            pending.append((count, signal_model.__name__))
        total_pending += count
    if pending:
        pending.sort()
        max_chars = len(str(pending[-1][0]))
        for n, signal_name in pending:
            click.echo('{} of type "{}"'.format(str(n).rjust(max_chars), signal_name))
    click.echo(25 * '-')
    click.echo('Total pending: {} '.format(total_pending))
1011174
def should_send(self, request):
        """"""
        if self.filters.get('whitelist', None):
            return request.tree.type in self.filters['whitelist']
        elif self.filters.get('blacklist', None):
            return request.tree.type not in self.filters['blacklist']
        else:
            return True
509675
def _check_fulfilled(self):
        
        is_fulfilled = False
        result = None
        start_time = time.time()

        # Check whether the promise has been fulfilled until we run out of time or attempts
        while self._has_time_left(start_time) and self._has_more_tries():

            # Keep track of how many attempts we've made so far
            self._num_tries += 1

            is_fulfilled, result = self._check_func()

            # If the promise is satisfied, then continue execution
            if is_fulfilled:
                break

            # Delay between checks
            time.sleep(self._try_interval)

        return is_fulfilled, result
218520
private function isRequestCacheEnabled()
    {
        if (!$this->requestCache) {
            return false;
        }

        return $this->config->get('requestCache')->get('enabled') && $this->getCacheKey() !== null;
    }
375700
static boolean isReady(@Nullable CompletableFuture<?> future) {
    return (future != null) && future.isDone()
        && !future.isCompletedExceptionally()
        && (future.join() != null);
  }
1359973
private boolean processCancelRequests() {
        // Try to make this as fast as possible. Don't need to sync
        // since if a cancel gets added after checking the size, we will
        // see it next time.
        if (cancelList.size() == 0) {
            return false;
        }

        boolean needSelectToOccur = false;

        final boolean bTrace = TraceComponent.isAnyTracingEnabled();
        synchronized (cancelList) {
            for (CancelRequest req : this.cancelList) {
                if (req.state == CancelRequest.Ready_To_Cancel) {
                    if (bTrace && tc.isDebugEnabled()) {
                        Tr.debug(this, tc, "cancelling key " + req.key);
                    }
                    req.key.cancel();
                    req.state = CancelRequest.Ready_To_Signal_Done;
                    needSelectToOccur = true;
                }
            }
        } // end-sync
        return needSelectToOccur;
    }
259004
def _has_no_pendings(self, statuses):
        
        return all(s != ClientBatchStatus.PENDING for s in statuses.values())