Pings the service and completes if successful - and fails if it didn't work
for some reason (reason is in the exception).
962261
private static Observable<PingServiceHealth> pingBinary(
        final NetworkAddress hostname, final String bucket,
        final ClusterFacade core, final long timeout, final TimeUnit timeUnit) {
        final AtomicReference<CouchbaseRequest> request = new AtomicReference<CouchbaseRequest>();
        Observable<NoopResponse> response = Observable.defer(new Func0<Observable<NoopResponse>>() {
            @Override
            public Observable<NoopResponse> call() {
                CouchbaseRequest r = new NoopRequest(bucket, hostname);
                request.set(r);
                return core.send(r);
            }
        }).timeout(timeout, timeUnit);
        return mapToServiceHealth(bucket, ServiceType.BINARY, response, request, timeout, timeUnit);
    }
159495
def request(self, service, data):
        
        _res = self._request(service, data)
        res = _res.json()[0][0]
        if res["success"] == True:
            return res["result"]
        else:
            err_msg = res["errmsg"]
            raise Exception("Request not successful: '{0}'".format(err_msg))
371344
void throwCloudExceptionIfInFailedState() {
        if (this.isStatusFailed()) {
            if (this.errorBody() != null) {
                throw new CloudException("Async operation failed with provisioning state: " + this.status(), this.response(), this.errorBody());
            } else {
                throw new CloudException("Async operation failed with provisioning state: " + this.status(), this.response());
            }
        }
    }
920753
public void awaitSuccess() throws Exception {
    FutureTask<Void> futureTask = results.poll(5, TimeUnit.SECONDS);
    if (futureTask == null) throw new AssertionError("no onRequest call received");
    futureTask.get(5, TimeUnit.SECONDS);
  }
350595
def _succeed(self, request_id, reply, duration):
        """"""
        self.listeners.publish_command_success(
            duration, reply, self.name,
            request_id, self.sock_info.address, self.op_id)
522792
private void serveError(Status status, ErrorMessage.FailureReason reason, RequestHandler requestHandler) throws IOException {
    this.serveError(status, reason.getMessage(), requestHandler);
  }
26519
@Then("^service '(.+?)' status in cluster '(.+?)' is '(suspended|running|deploying)'( in less than '(\\d+?)' seconds checking every '(\\d+?)' seconds)?")
    public void serviceStatusCheck(String service, String cluster, String status, String foo, Integer totalWait, Integer interval) throws Exception {
        String response;
        Integer i = 0;
        boolean matched;

        response = commonspec.retrieveServiceStatus(service, cluster);

        if (foo != null) {
            matched = status.matches(response);
            while (!matched && i < totalWait) {
                this.commonspec.getLogger().info("Service status not found yet after " + i + " seconds");
                i = i + interval;
                response = commonspec.retrieveServiceStatus(service, cluster);
                matched = status.matches(response);
            }
        }

        assertThat(status).as("Expected status: " + status + " doesn't match obtained one: " + response).matches(response);

    }
982282
@Service
    public boolean ackTaskReceived(String taskId) {
        LOGGER.debug("Ack received for task: {}", taskId);
        boolean ackResult;
        try {
            ackResult = executionService.ackTaskReceived(taskId);
        } catch (Exception e) {
            // safe to ignore exception here, since the task will not be processed by the worker due to ack failure
            // The task will eventually be available to be polled again after the unack timeout
            LOGGER.error("Exception when trying to ack task {}", taskId, e);
            ackResult = false;
        }
        return ackResult;
    }
577544
async def wait(self):
        
        if self._ping_task is None:
            raise RuntimeError('Response is not started')
        with contextlib.suppress(asyncio.CancelledError):
            await self._ping_task
871045
public void requestFailed (final Exception cause)
    {
        apply(new ObserverOp<ResultListener<T>>() {
            public boolean apply (ResultListener<T> observer) {
                observer.requestFailed(cause);
                return true;
            }
        });
    }
1205446
def _except_if_failed(cls, event):
        """"""
        if event.success is None:
            raise IOTSyncTimeout('Requested timed out', event)
        if not event.success:
            msg = "Request failed, unknown error"
            if isinstance(event.payload, Mapping):
                if P_MESSAGE in event.payload:
                    msg = event.payload[P_MESSAGE]
                try:
                    exc_class = cls.__exception_mapping[event.payload[P_CODE]]
                except KeyError:
                    pass
                else:
                    raise exc_class(msg, event)

            raise IOTException(msg, event)
958673
@SuppressWarnings("deprecation")
  public void failedTask(
    TaskInProgress tip,
    TaskAttemptID taskid,
    String reason,
    TaskStatus.Phase phase,
    boolean isFailed,
    String trackerName,
    TaskTrackerInfo ttStatus) {
    TaskStatus.State state =
      isFailed ? TaskStatus.State.FAILED: TaskStatus.State.KILLED;
    TaskStatus status = TaskStatus.createTaskStatus(tip.isMapTask(),
                                                    taskid,
                                                    0.0f,
                                                    1,
                                                    state,
                                                    reason,
                                                    reason,
                                                    trackerName, phase,
                                                    new Counters());
    synchronized (lockObject) {
      // update the actual start-time of the attempt
      TaskStatus oldStatus = tip.getTaskStatus(taskid);
      long startTime = oldStatus == null
      ? JobTracker.getClock().getTime()
          : oldStatus.getStartTime();
      if (startTime < 0) {
        startTime = JobTracker.getClock().getTime();
      }
      status.setStartTime(startTime);
      status.setFinishTime(JobTracker.getClock().getTime());
      boolean wasComplete = tip.isComplete();
      updateTaskStatus(tip, status, ttStatus);
      boolean isComplete = tip.isComplete();
      if (wasComplete && !isComplete) { // mark a successful tip as failed
        String taskType = getTaskType(tip);
        JobHistory.Task.logFailed(tip.getTIPId(), taskType,
            tip.getExecFinishTime(), reason, taskid);
      }
    }
  }
591904
private static void doExecute(Executor executor, Runnable runnable) {
    try {
      executor.execute(runnable);
    } catch (Throwable th) {
      log.log(Level.SEVERE, "Failed to execute PingCallback", th);
    }
  }
1068871
@Override
    protected void doStart() {
        Exceptions.checkNotClosed(this.closed.get(), this);
        notifyStarted();
        log.info("{}: Started.", this.traceObjectId);
        this.runTask = doRun();
        this.runTask.whenComplete((r, ex) -> {
            // Handle any exception that may have been thrown.
            if (ex != null
                    && !(Exceptions.unwrap(ex) instanceof CancellationException && state() != State.RUNNING)) {
                // We ignore CancellationExceptions while shutting down - those are expected.
                errorHandler(ex);
            }

            // Make sure the service is stopped when the runTask is done (whether successfully or not).
            if (state() == State.RUNNING) {
                stopAsync();
            }
        });
    }
722550
def is_ceil_reached(self, service):
        
        failed = service.provider_failed + 1
        if failed > settings.DJANGO_TH.get('failed_tries', 10):
            TriggerService.objects.filter(id=service.id).update(date_result=now(), status=False)
        else:
            TriggerService.objects.filter(id=service.id).update(date_result=now(), provider_failed=failed)

        warn_user_and_admin('provider', service)
95921
public void onFailure (Throwable cause)
    {
        _panel.clear();
        _panel.add(Widgets.newLabel(formatError(cause), "errorLabel"));
        Console.log("Service request failed", cause);
    }
1115195
def task_succeeded(sender=None, **kwargs):  # pylint: disable=unused-argument
    
    if isinstance(sender, UserTaskMixin):
        status = sender.status
        # Failed tasks with good exception handling did not succeed just because they ended cleanly
        if status.state not in (UserTaskStatus.CANCELED, UserTaskStatus.FAILED, UserTaskStatus.RETRYING):
            status.succeed()
        user_task_stopped.send_robust(sender=UserTaskStatus, status=sender.status)