Update cluster state given a failed MetadataRequest.
482035
def failed_update(self, exception):
        """"""
        f = None
        with self._lock:
            if self._future:
                f = self._future
                self._future = None
        if f:
            f.failure(exception)
        self._last_refresh_ms = time.time() * 1000
705202
public static base_response update(nitro_service client, clusternodegroup resource) throws Exception {
		clusternodegroup updateresource = new clusternodegroup();
		updateresource.name = resource.name;
		updateresource.strict = resource.strict;
		return updateresource.update_resource(client);
	}
40721
private void handleRequestFailure(long requestId, Throwable error, ThreadContext context) {
    ByteBuf buffer = channel.alloc().buffer(10)
      .writeByte(RESPONSE)
      .writeLong(requestId)
      .writeByte(FAILURE);

    try {
      writeError(buffer, error, context);
    } catch (SerializationException e) {
      return;
    }

    channel.writeAndFlush(buffer, channel.voidPromise());
  }
751065
def update_resource(self, path, data, if_match=None):
        """"""
        response = self._http_request(resource=path, method="PUT", body=data,
                                      if_match=if_match)
        try:
            return response.json()
        except ValueError:
            raise exception.ServiceException("Invalid service response.")
1097082
def _maybe_refresh_metadata(self, wakeup=False):
        
        ttl = self.cluster.ttl()
        wait_for_in_progress_ms = self.config['request_timeout_ms'] if self._metadata_refresh_in_progress else 0
        metadata_timeout = max(ttl, wait_for_in_progress_ms)

        if metadata_timeout > 0:
            return metadata_timeout

        # Beware that the behavior of this method and the computation of
        # timeouts for poll() are highly dependent on the behavior of
        # least_loaded_node()
        node_id = self.least_loaded_node()
        if node_id is None:
            log.debug("Give up sending metadata request since no node is available");
            return self.config['reconnect_backoff_ms']

        if self._can_send_request(node_id):
            topics = list(self._topics)
            if not topics and self.cluster.is_bootstrap(node_id):
                topics = list(self.config['bootstrap_topics_filter'])

            if self.cluster.need_all_topic_metadata or not topics:
                topics = [] if self.config['api_version'] < (0, 10) else None
            api_version = 0 if self.config['api_version'] < (0, 10) else 1
            request = MetadataRequest[api_version](topics)
            log.debug("Sending metadata request %s to node %s", request, node_id)
            future = self.send(node_id, request, wakeup=wakeup)
            future.add_callback(self.cluster.update_metadata)
            future.add_errback(self.cluster.failed_update)

            self._metadata_refresh_in_progress = True
            def refresh_done(val_or_error):
                self._metadata_refresh_in_progress = False
            future.add_callback(refresh_done)
            future.add_errback(refresh_done)
            return self.config['request_timeout_ms']

        # If there's any connection establishment underway, wait until it completes. This prevents
        # the client from unnecessarily connecting to additional nodes while a previous connection
        # attempt has not been completed.
        if self._connecting:
            return self.config['reconnect_backoff_ms']

        if self.maybe_connect(node_id, wakeup=wakeup):
            log.debug("Initializing connection to node %s for metadata request", node_id)
            return self.config['reconnect_backoff_ms']

        # connected but can't send more, OR connecting
        # In either case we just need to wait for a network event
        # to let us know the selected connection might be usable again.
        return float('inf')
746927
public static void retry(final CouchbaseRequest request, final EventSink<ResponseEvent> responseBuffer) {
        if(!responseBuffer.tryPublishEvent(ResponseHandler.RESPONSE_TRANSLATOR, request, request.observable())) {
            request.observable().onError(CouchbaseCore.BACKPRESSURE_EXCEPTION);
        }
    }
1258537
private void failMapUnprotected(TaskInProgress tip) {
    if (nonRunningMaps == null) {
      LOG.warn("Non-running cache for maps missing!! "
               + "Job details are missing.");
      return;
    }
    nonRunningMaps.add(tip);
  }
64534
def reset_failed(self, pk):
        
        TriggerService.objects.filter(consumer__name__id=pk).update(consumer_failed=0, provider_failed=0)
        TriggerService.objects.filter(provider__name__id=pk).update(consumer_failed=0, provider_failed=0)
165797
def refresh_druid(datasource, merge):
    """"""
    session = db.session()
    from superset.connectors.druid.models import DruidCluster
    for cluster in session.query(DruidCluster).all():
        try:
            cluster.refresh_datasources(datasource_name=datasource,
                                        merge_flag=merge)
        except Exception as e:
            print(
                "Error while processing cluster '{}'\n{}".format(
                    cluster, str(e)))
            logging.exception(e)
        cluster.metadata_last_refreshed = datetime.now()
        print(
            'Refreshed metadata from cluster '
            '[' + cluster.cluster_name + ']')
    session.commit()
124748
def update_status(unsent_reg_ids, all_results, multicast_result)
      results = multicast_result.results
      raise RuntimeError, "Internal error: sizes do not match. currentResults: #{results}; unsentRegIds: #{unsent_reg_ids}" unless results.size==unsent_reg_ids.size
      new_unsent_reg_ids = []
      unsent_reg_ids.each_with_index {|reg_id, index|
        result = results[index]
        all_results[reg_id]= result
        new_unsent_reg_ids << reg_id unless (result.error_code.nil? || result.error_code.eql?(ERROR_UNAVAILABLE))
      }
      new_unsent_reg_ids
    end
289930
public void updateMetadataVersions() {
        Properties versionProps = MetadataVersionStoreUtils.getProperties(this.systemStoreRepository.getMetadataVersionStore());
        Long newVersion = fetchNewVersion(SystemStoreConstants.CLUSTER_VERSION_KEY,
                                          null,
                                          versionProps);
        if(newVersion != null) {
            this.currentClusterVersion = newVersion;
        }
    }
113992
public static base_responses update(nitro_service client, clusterinstance resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			clusterinstance updateresources[] = new clusterinstance[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new clusterinstance();
				updateresources[i].clid = resources[i].clid;
				updateresources[i].deadinterval = resources[i].deadinterval;
				updateresources[i].hellointerval = resources[i].hellointerval;
				updateresources[i].preemption = resources[i].preemption;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
1224090
public void processAnyCallbacksFromFailedHosts(Set<Integer> failedHosts) {
        synchronized(m_allHostCallbackLock) {
            failedHosts.stream()
                .forEach(i -> {
                    if (m_outstandingAllHostProcedureHostIds.contains(i)) {
                        ClientResponseImpl cri = new ClientResponseImpl(
                                ClientResponse.CONNECTION_LOST,
                                new VoltTable[0],
                                "Host " + i + " failed, connection lost");
                        // embed the hostid as a string in app status string
                        // because the recipient expects this hack
                        cri.setAppStatusString(String.valueOf(i));

                        allHostNTProcedureCallback(cri);
                    }
                });
        }
    }
265331
def set(self, field, clusters, value, add_to_stack=True):
        """"""
        # Add the field if it doesn't exist.
        if field not in self._fields:
            self.add_field(field)
        assert field in self._fields

        clusters = _as_list(clusters)
        for cluster in clusters:
            if cluster not in self._data:
                self._data[cluster] = {}
            self._data[cluster][field] = value

        up = UpdateInfo(description='metadata_' + field,
                        metadata_changed=clusters,
                        metadata_value=value,
                        )
        undo_state = self.emit('request_undo_state', up)

        if add_to_stack:
            self._undo_stack.add((clusters, field, value, up, undo_state))
            self.emit('cluster', up)

        return up
709495
def failback_from_replicant(self, volume_id, replicant_id):
        

        return self.client.call('Network_Storage', 'failbackFromReplicant',
                                replicant_id, id=volume_id)
1324844
void updateFromResponseOnPutPatch(Response<ResponseBody> response) throws CloudException, IOException {
        String responseContent = null;
        if (response.body() != null) {
            responseContent = response.body().string();
            response.body().close();
        }

        if (responseContent == null || responseContent.isEmpty()) {
            throw new CloudException("polling response does not contain a valid body", response);
        }

        PollingResource resource = serializerAdapter.deserialize(responseContent, PollingResource.class);
        final int statusCode = response.code();
        if (resource != null && resource.properties != null && resource.properties.provisioningState != null) {
            this.withStatus(resource.properties.provisioningState, statusCode);
        } else {
            this.withStatus(AzureAsyncOperation.SUCCESS_STATUS, statusCode);
        }

        CloudError error = new CloudError();
        this.withErrorBody(error);
        error.withCode(this.status());
        error.withMessage("Long running operation failed");
        this.withResponse(response);
        this.withResource(serializerAdapter.<T>deserialize(responseContent, resourceType));
    }
913030
private void failRequests() {
    final Set<OngoingRequest> requests = ImmutableSet.copyOf(outstanding);
    for (OngoingRequest id : requests) {
      final boolean removed = outstanding.remove(id);
      if (removed) {
        id.reply(Response.forStatus(Status.SERVICE_UNAVAILABLE));
      }
    }
  }