Whether previous slice retry has ended according to Logs API.

    Args:
      shard_state: shard state.

    Returns:
      True if the request of previous slice retry has ended. False if it has
    not or unknown.
513543
def _has_old_request_ended(self, shard_state):
    
    assert shard_state.slice_start_time is not None
    assert shard_state.slice_request_id is not None
    request_ids = [shard_state.slice_request_id]
    logs = None
    try:
      logs = list(logservice.fetch(request_ids=request_ids))
    except (apiproxy_errors.FeatureNotEnabledError,
        apiproxy_errors.CapabilityDisabledError) as e:
      # Managed VMs do not have access to the logservice API
      # See https://groups.google.com/forum/#!topic/app-engine-managed-vms/r8i65uiFW0w
      logging.warning("Ignoring exception: %s", e)

    if not logs or not logs[0].finished:
      return False
    return True
1280025
def is_lock_pending(
        end_state: NettingChannelEndState,
        secrethash: SecretHash,
) -> bool:
    
    return (
        secrethash in end_state.secrethashes_to_lockedlocks or
        secrethash in end_state.secrethashes_to_unlockedlocks or
        secrethash in end_state.secrethashes_to_onchain_unlockedlocks
    )
984855
def expired? connection
    return true  if     @max_requests && connection.requests >= @max_requests
    return false unless @idle_timeout
    return true  if     @idle_timeout.zero?

    Time.now - connection.last_use > @idle_timeout
  end
1127605
private boolean hasMessages(String shardName) throws MessageQueueException {
        UUID currentTime = TimeUUIDUtils.getUniqueTimeUUIDinMicros();

        try {
            ColumnList<MessageQueueEntry> result = keyspace.prepareQuery(queueColumnFamily)
                    .setConsistencyLevel(consistencyLevel)
                    .getKey(shardName)
                    .withColumnRange(new RangeBuilder()
                        .setLimit(1)   // Read extra messages because of the lock column
                    .setStart(entrySerializer
                                .makeEndpoint((byte)MessageQueueEntryType.Message.ordinal(), Equality.EQUAL)
                                .toBytes()
                                )
                    .setEnd(entrySerializer
                                .makeEndpoint((byte)MessageQueueEntryType.Message.ordinal(), Equality.EQUAL)
                                .append((byte)0, Equality.EQUAL)
                                .append(currentTime, Equality.LESS_THAN_EQUALS)
                                .toBytes()
                                )
                    .build())
                    .execute()
                    .getResult();
            return !result.isEmpty();
        } catch (ConnectionException e) {
            throw new MessageQueueException("Error checking shard for messages. " + shardName, e);
        }
    }
889119
def is_closed(self):
        
        return (self.state == SESSION_STATE.CLOSED 
                or self.state == SESSION_STATE.CLOSING)
123502
def is_error_retryable(request, exc):
    
    if is_last_attempt(request):
        return False

    return (
        isinstance(exc, RetryableException)
        or IRetryableError.providedBy(exc)
    )
10323
def check_the_end_flag(self, state_key):
        '''
        
        '''
        # As a rule, the learning can not be stopped.
        x, y = state_key
        end_point_tuple = np.where(self.__map_arr == self.__end_point_label)
        end_point_x_arr, end_point_y_arr = end_point_tuple
        if x == end_point_x_arr[0] and y == end_point_y_arr[0]:
            return True
        else:
            return False
978853
def last_component_continued(self):
        # type: () -> bool
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('SL record not yet initialized!')

        if not self.symlink_components:
            raise pycdlibexception.PyCdlibInternalError('Trying to get continued on a non-existent component!')

        return self.symlink_components[-1].is_continued()
522463
def is_done(self):
        

        return (not self.wait_for_output or self.eof) and \
                not (hasattr(self.to_stream, 'needs_write') and self.to_stream.needs_write())
610119
public boolean isAlwaysFalse() {
        if (shardingConditions.isEmpty()) {
            return false;
        }
        for (ShardingCondition each : shardingConditions) {
            if (!(each instanceof AlwaysFalseShardingCondition)) {
                return false;
            }
        }
        return true;
    }
273377
def _need_stop(self):
        
        if not self.option.cursor_end_time:
            return False

        all_finish = True
        for shard, consumer in self.shard_consumers.items():
            if consumer.is_shutdown():
                continue

            # has not yet do any successful fetch yet or get some data
            if consumer.last_success_fetch_time == 0 or consumer.last_fetch_count > 0:
                return False

        # init self.last_owned_consumer_finish_time if it's None
        if all_finish and self.last_owned_consumer_finish_time == 0:
            self.last_owned_consumer_finish_time = time.time()

        if abs(time.time() - self.last_owned_consumer_finish_time) >= \
                self.option.consumer_group_time_out + self.option.heartbeat_interval:
            return True

        return False
141759
async def check_ping_timeout(self):
        
        if self.closed:
            raise exceptions.SocketIsClosedError()
        if time.time() - self.last_ping > self.server.ping_interval + 5:
            self.server.logger.info('%s: Client is gone, closing socket',
                                    self.sid)
            # Passing abort=False here will cause close() to write a
            # CLOSE packet. This has the effect of updating half-open sockets
            # to their correct state of disconnected
            await self.close(wait=False, abort=False)
            return False
        return True
626212
def _should_retry(exc):
    
    if not hasattr(exc, "errors"):
        return False

    if len(exc.errors) == 0:
        # Check for unstructured error returns, e.g. from GFE
        return isinstance(exc, _UNSTRUCTURED_RETRYABLE_TYPES)

    reason = exc.errors[0]["reason"]
    return reason in _RETRYABLE_REASONS
335296
def task_completed(task_id):
    

    tasks = get_tasks(task_id=task_id)
    completed_states = ('TASK_FINISHED',
                        'TASK_FAILED',
                        'TASK_KILLED',
                        'TASK_LOST',
                        'TASK_ERROR')

    for task in tasks:
        if task['state'] in completed_states:
            return True

    return False
396484
def is_retryable(err):
    
    if isinstance(err, ConnectionClosed):
        # NB: only retryable if we're not mid-streaming
        if err.mid_stream:
            return False
        else:
            return True
    elif isinstance(err, socket.error):
        code = err.args[0]
        return code in CONN_CLOSED_ERRORS
    else:
        return False
824956
@Override
	public void finishStage(ResponseBuilder rb) {
		if (rb.req.getParams().getBool(MtasSolrSearchComponent.PARAM_MTAS, false)) {
			if (rb.stage >= ResponseBuilder.STAGE_EXECUTE_QUERY && rb.stage < ResponseBuilder.STAGE_GET_FIELDS) {
				for (ShardRequest sreq : rb.finished) {
					if (sreq.params.getBool(MtasSolrSearchComponent.PARAM_MTAS, false)
							&& sreq.params.getBool(PARAM_MTAS_VERSION, false)) {
						for (ShardResponse shardResponse : sreq.responses) {
							NamedList<Object> solrShardResponse = shardResponse.getSolrResponse().getResponse();
							try {
								SimpleOrderedMap<Object> data = (SimpleOrderedMap<Object>) solrShardResponse
										.findRecursive(MtasSolrSearchComponent.NAME, NAME);
								// create shardInfo
								SimpleOrderedMap<Object> dataShard = new SimpleOrderedMap<>();
								dataShard.add(NAME_MTAS_VERSION_SHARD, shardResponse.getShard());
								dataShard.add(NAME, data.clone());
								List<SimpleOrderedMap> dataShards = new ArrayList<>();
								dataShards.add(dataShard);
								// create main data
								data.clear();
								data.addAll(getVersion());
								// add shardInfo
								data.add(NAME_MTAS_VERSION_SHARDS, dataShards);
							} catch (ClassCastException | IOException e) {
								log.debug(e);
								// shouldn't happen
							}

						}
					}
				}

			}
		}

	}
276690
def is_done(self):
        """"""
        return self.position.is_game_over() or self.position.n >= FLAGS.max_game_length