Check if there's a failed shard in the scan query
491511
def validate_scan_result(results):
        
        if results[EsConst.SHARDS][EsConst.FAILED] and results[EsConst.SHARDS][EsConst.FAILED] > 0:
            raise ScanError(
                'Scroll request has failed on %d shards out of %d.' %
                (results[EsConst.SHARDS][EsConst.FAILED], results[EsConst.SHARDS][EsConst.TOTAL])
            )
1349488
def is_in_shard(self, s):
    
    return self.compute_shard(s, self._nshards) == self._shard
1083649
private void checkForFailure(FilterJoinNode node) {
    if (node.hasFailure()) {
      logger.error("Node processing failed: {}", node.getFailure());
      throw new ElasticsearchException("Unexpected failure while processing a node", node.getFailure());
    }
  }
627824
def failed(self, group=None, start=0, limit=25):
        ''''''
        if not group:
            return json.loads(self.client('failed'))
        else:
            results = json.loads(
                self.client('failed', group, start, limit))
            results['jobs'] = self.get(*results['jobs'])
            return results
188643
public function hasFailed()
    {
        if($this->failed == false || $this->passed == true)
        {
            $this->failed = true;
            $this->passed = false;
        }
    }
1102977
private void checkNewlySharded(DBObject dbObj, Map<String, String> currScalarMap) {
        if (!m_tableDef.isSharded()) {
            return;
        }
        String shardingFieldName = m_tableDef.getShardingField().getName();
        if (!currScalarMap.containsKey(shardingFieldName)) {
            m_dbTran.addAllObjectsColumn(m_tableDef, dbObj.getObjectID(), m_tableDef.getShardNumber(dbObj));
        }
    }
71668
def verify(self, checksum=None, token=None, full_response=False):
        """"""
        payload = {"checksum":checksum, "a":"verify"}
        if token:
            payload.update({"token":token})
        return self.get_shards(Shard(**payload), full_response=True)
944622
def failed_hosts(self):
        """"""
        return {h: r for h, r in self.items() if r.failed}
146507
private void check() throws CouchbaseLiteException {
        synchronized (lock) {
            if (c4query != null) { return; }

            database = (Database) from.getSource();
            final String json = encodeAsJson();
            Log.v(DOMAIN, "Query encoded as %s", json);
            if (json == null) { throw new CouchbaseLiteException("Failed to generate JSON query."); }

            if (columnNames == null) { columnNames = generateColumnNames(); }

            try {
                c4query = database.getC4Database().createQuery(json);
            }
            catch (LiteCoreException e) {
                throw CBLStatus.convertException(e);
            }
        }
    }
1332451
def shard_id(self):
        """"""
        count = self._state.shard_count
        if count is None:
            return None
        return (self.id >> 22) % count
405694
public function setFailQueryFailed(bool $fail_query_failed = true) : void
    {
        $this->query_succeeded = false;
        $this->fail_query_failed = $fail_query_failed;
    }
743246
def checkIfHashIsCracked(hash=None):
	

	apiURL = "http://md5db.net/api/" + str(hash).lower()

	try:

		# Getting the result of the query from MD5db.net
		data = urllib2.urlopen(apiURL).read()
		return data

	except:
		# No information was found, then we return a null entity
		return []
1218462
def with_all(continue_on_error = false)
      cluster.shards.map do |shard|
        begin
          with_shard(shard) {
            yield
          }
        rescue Exception => err
          unless continue_on_error
            raise err
          end
          err
        end
      end
    end
661434
public void processFailure(QueryBatchException queryBatch) {
    boolean isHostUnavailableException = processException(queryBatch.getBatcher(), queryBatch, queryBatch.getClient().getHost());
    if ( isHostUnavailableException == true ) {
      try {
        logger.warn("Retrying failed batch: {}, results so far: {}, forest: {}, forestBatch: {}, forest results so far: {}",
          queryBatch.getJobBatchNumber(), queryBatch.getJobResultsSoFar(), queryBatch.getForest().getForestName(),
          queryBatch.getForestBatchNumber(), queryBatch.getForestResultsSoFar());
        queryBatch.getBatcher().retryWithFailureListeners(queryBatch);
      } catch (RuntimeException e) {
        logger.error("Exception during retry", e);
        processFailure(new QueryBatchException(queryBatch, e));
      }
    }
  }
1251999
def failed(self, **kwargs):
        """"""
        self.finished = datetime.now()
        self.status = 'failed'
        self.information.update(kwargs)
        self.logger.info("Failed - took %f seconds.", self.duration())
        self.update_report_collector(int(time.mktime(self.finished.timetuple())))
910147
def handle_error(ex, file_name)
      if ex.message == "NOSCRIPT No matching script. Please use EVAL."
        SCRIPT_SHAS.delete(file_name)
        return yield if block_given?
      end

      raise ScriptError, file_name: file_name, source_exception: ex
    end
111182
function (clt_name, onSuccess, onFail, query_obj) {

	// error check
	var collection = l_getCollection(clt_name, onFail);
	if (collection === undefined) {
		return;
	}

	var is_empty = (query_obj === undefined ||
					l_isEmpty(query_obj));
	var query = {};

	// check if there's a specific query
	if (query_obj !== undefined) {
		query = query_obj;
	}

	// if not in cache, get data from DB and cache in memory
	//LOG.sys('data caching from [' + clt_name + '], query: ' + query + '...', 'SR.DB');

	try {

		// load all documents from the DB
		collection.findOne(query,
			function (err, data)
			{
				if (err) {
					return l_notifyError(clt_name, 'cacheData', err, onFail);
				}

				// something returned but is empty
				if (data === undefined ||
					data === null ||
					data === '') {

					LOG.warn('data not found for [' + clt_name + '] query: ' + JSON.stringify(query), 'SR.DB');
					return UTIL.safeCall(onSuccess, null);
				}

				// store all if is_empty, or store single object
				if (is_empty) {
					collection.cache = data;
					//LOG.sys('caching all objects...', 'SR.DB');
				} else {
					collection.cache[data._id] = data;
					//LOG.sys('caching single object, query: ' + query_obj, 'SR.DB');
				}

				//LOG.sys('returning data for id: ' + data._id, 'SR.DB');
				UTIL.safeCall(onSuccess, data);
			}
		);
	} catch (err) {
		l_notifyError(clt_name, 'cacheData.exception', err, onFail, true);
	}
}