The job is done since all it's component tasks are either
successful or have failed.
7242
@SuppressWarnings("deprecation")
  private void jobCompleteUnprotected() {
    //
    // All tasks are complete, then the job is done!
    
    if(this.terminated == JobStatus.FAILED 
        || this.terminated == JobStatus.KILLED) {
      terminate(this.terminated);
    }
    if (this.status.getRunState() == JobStatus.RUNNING ||
        this.status.getRunState() == JobStatus.PREP) {
      changeStateTo(JobStatus.SUCCEEDED);
      this.status.setCleanupProgress(1.0f);
      if (maps.length == 0) {
        this.status.setMapProgress(1.0f);
      }
      if (reduces.length == 0) {
        this.status.setReduceProgress(1.0f);
      }
      this.finishTime = clock.getTime();
      LOG.info("Job " + this.status.getJobID() +
               " has completed successfully.");

      // Log the job summary (this should be done prior to logging to
      // job-history to ensure job-counters are in-sync
      JobSummary.logJobSummary(this);

      Counters counters = getCounters();
      // Log job-history
      jobHistory.logFinished(finishTime,
                             this.finishedMapTasks,
                             this.finishedReduceTasks, failedMapTasks,
                             failedReduceTasks, killedMapTasks,
                             killedReduceTasks, getMapCounters(),
                             getReduceCounters(), counters);
    }
  }
1331499
def on_failure(self, exc, task_id, args, kwargs, einfo):
        """"""
        super().on_failure(exc, task_id, args, kwargs, einfo)
        if isinstance(exc, OperationRunDoesNotExist):
            return
        self._operation_run.on_failure()
507453
private synchronized void onJobFailure(final JobStatusProto jobStatusProto) {
    assert jobStatusProto.getState() == ReefServiceProtos.State.FAILED;

    final String id = this.jobId;
    final Optional<byte[]> data = jobStatusProto.hasException() ?
        Optional.of(jobStatusProto.getException().toByteArray()) :
        Optional.<byte[]>empty();
    final Optional<Throwable> cause = this.exceptionCodec.fromBytes(data);

    final String message;
    if (cause.isPresent() && cause.get().getMessage() != null) {
      message = cause.get().getMessage();
    } else {
      message = "No Message sent by the Job in exception " + cause.get();
      LOG.log(Level.WARNING, message, cause.get());
    }
    final Optional<String> description = Optional.of(message);

    final FailedJob failedJob = new FailedJob(id, message, description, cause, data);
    this.failedJobEventHandler.onNext(failedJob);
  }
661244
def is_successful(self, retry=False):
        

        if not self.is_terminated(retry=retry):
            return False
        retry_num = options.retry_times
        while retry_num > 0:
            try:
                statuses = self.get_task_statuses()
                return all(task.status == Instance.Task.TaskStatus.SUCCESS
                           for task in statuses.values())
            except (errors.InternalServerError, errors.RequestTimeTooSkewed):
                retry_num -= 1
                if not retry or retry_num <= 0:
                    raise
938070
protected void failure(final Throwable thrwbl, final Job job, final String curQueue) {
        // The job may have taken a long time; make an effort to ensure the connection is OK
        JedisUtils.ensureJedisConnection(this.jedis);
        try {
            this.jedis.incr(key(STAT, FAILED));
            this.jedis.incr(key(STAT, FAILED, this.name));
            final FailQueueStrategy strategy = this.failQueueStrategyRef.get();
            final String failQueueKey = strategy.getFailQueueKey(thrwbl, job, curQueue);
            if (failQueueKey != null) {
                final int failQueueMaxItems = strategy.getFailQueueMaxItems(curQueue);
                if (failQueueMaxItems > 0) {
                    Long currentItems = this.jedis.llen(failQueueKey);
                    if (currentItems >= failQueueMaxItems) {
                        Transaction tx = this.jedis.multi();
                        tx.ltrim(failQueueKey, 1, -1);
                        tx.rpush(failQueueKey, failMsg(thrwbl, curQueue, job));
                        tx.exec();
                    } else {
                        this.jedis.rpush(failQueueKey, failMsg(thrwbl, curQueue, job));
                    }
                } else {
                    this.jedis.rpush(failQueueKey, failMsg(thrwbl, curQueue, job));
                }
            }
        } catch (JedisException je) {
            LOG.warn("Error updating failure stats for throwable=" + thrwbl + " job=" + job, je);
        } catch (IOException ioe) {
            LOG.warn("Error serializing failure payload for throwable=" + thrwbl + " job=" + job, ioe);
        }
        this.listenerDelegate.fireEvent(JOB_FAILURE, this, curQueue, job, null, null, thrwbl);
    }
336105
def finish_job(client, cleanup_job, job_completed_normally, client_outputs, pulsar_outputs):
    
    collection_failure_exceptions = []
    if job_completed_normally:
        output_collector = ClientOutputCollector(client)
        action_mapper = FileActionMapper(client)
        results_stager = ResultsCollector(output_collector, action_mapper, client_outputs, pulsar_outputs)
        collection_failure_exceptions = results_stager.collect()
    _clean(collection_failure_exceptions, cleanup_job, client)
    return collection_failure_exceptions
1122015
public synchronized boolean fail(ServiceException ex) {
        if (completed) {
            return false;
        }
        this.completed = true;
        this.ex = ex;
        notifyAll();
        return true;
    }
1369191
public void logTaskFailed(TaskID taskId, String taskType, long time,
      String error) {
    logTaskFailed(taskId, taskType, time, error, null);
  }
903555
protected CompletableFuture<ExecutionResult> onFailureAsync(ExecutionResult result, Scheduler scheduler,
      FailsafeFuture<Object> future) {
    return CompletableFuture.completedFuture(onFailure(result));
  }
792193
function failure(item, err, ctx) {
		item.count++;
		item.failures++;

		checkThreshold(item, ctx);
	}
1241112
private void submitResults(Object task, Object results) throws JobExecutionException {
    synchronized (monitor) {
      this.job.submitTaskResults(task, results, monitor);
    }
  }
662012
boolean failure(Throwable failure) {
        State<T> oldState;
        synchronized (mutex) {
            if (state.isCompleted()) {
                return false;
            }
            oldState = state;
            state = state.getFailureState(failure);
        }
        oldState.callFailureCallbacks(failure);
        return true;
    }
862884
def job_failed(self, device, action, message):
        """"""
        if not self._mounter.is_handleable(device):
            return
        device_file = device.device_presentation or device.object_path
        if message:
            text = _('failed to {0} {1}:\n{2}', action, device_file, message)
        else:
            text = _('failed to {0} device {1}.', action, device_file)
        try:
            retry = getattr(self._mounter, action)
        except AttributeError:
            retry_action = None
        else:
            retry_action = ('retry', _('Retry'), retry, device)
        self._show_notification(
            'job_failed',
            _('Job failed'), text,
            device.icon_name,
            retry_action)
59342
function handleSuccess() {

    // If any activities failed, we need to fail the workflow
    if (context.failed()) {
      winston.log('warn', 'One of more activities failed in workflow: %s, marking workflow as failed', self.name);

      // Respond back to SWF failing the workflow
      decisionTask.response.fail('Activities failed', { failures: context.errorMessages }, function (err) {
        if (err) {
          winston.log('error', 'Unable to mark workflow: %s as failed due to: %s', self.name, JSON.stringify(err));
          return;
        }
      });

    } else {

      // Check to see if we are done with the workflow
      if (context.done()) {
        winston.log('info', 'Workflow: %s has completed successfuly', self.name);

        // Stop the workflow
        decisionTask.response.stop({
          result: JSON.stringify(context.results)
        });
      }

      // If no decisions made this round, skip
      if (!decisionTask.response.decisions) {
        winston.log('debug', 'No decision can be made this round for workflow: %s', self.name);
        // Record our state when we can't make a decision to help in debugging
        // decisionTask.response.add_marker('current-state', JSON.stringify(context.currentStatus()));
        decisionTask.response.wait();
      }

      // Respond back to SWF with all decisions
      decisionTask.response.respondCompleted(decisionTask.response.decisions, function (err) {
        if (err) {
          winston.log('error', 'Unable to respond to workflow: %s with decisions due to: %s', self.name, JSON.stringify(err));
          return;
        }
      });
    }
  }
1289503
@Override
	public void onTaskFailure(Execution taskExecution, Throwable cause) {
		final ExecutionVertex ev = taskExecution.getVertex();
		final FailoverRegion failoverRegion = vertexToRegion.get(ev);

		if (failoverRegion == null) {
			executionGraph.failGlobal(new FlinkException(
					"Can not find a failover region for the execution " + ev.getTaskNameWithSubtaskIndex(), cause));
		}
		else {
			LOG.info("Recovering task failure for {} #{} ({}) via restart of failover region",
					taskExecution.getVertex().getTaskNameWithSubtaskIndex(),
					taskExecution.getAttemptNumber(),
					taskExecution.getAttemptId());

			failoverRegion.onExecutionFail(taskExecution, cause);
		}
	}
72312
def run_all
      passed, failed_examples, passed_examples = Runner.run(['spec'], options.merge({ :message => 'Run all specs'}))

      self.rerun_specs = failed_examples
      self.last_run_passed = passed

      throw :task_has_failed unless passed
    end
1292241
private void markInstanceExecutionFailed(WSJobInstance jobInstance, WSJobExecution jobExecution, String correlationId) {

        //Disregard any attempted transitions out of the ABANDONED state.
        if (jobInstance.getBatchStatus() == BatchStatus.ABANDONED) {

            if (logger.isLoggable(Level.FINE)) {
                logger.fine("Attempt to transition from BatchStatus ABANDONED to FAILED is disallowed. ");
            }

            return;
        }

        getPersistenceManagerService().updateJobInstanceWithInstanceStateAndBatchStatus(jobInstance.getInstanceId(),
                                                                                        InstanceState.FAILED,
                                                                                        BatchStatus.FAILED,
                                                                                        new Date());

        publishEvent(jobInstance, BatchEventsPublisher.TOPIC_INSTANCE_FAILED, correlationId);

        getPersistenceManagerService().updateJobExecutionAndInstanceOnStatusChange(jobExecution.getExecutionId(),
                                                                                   BatchStatus.FAILED,
                                                                                   new Date());

        publishEvent(jobExecution, BatchEventsPublisher.TOPIC_EXECUTION_FAILED, correlationId);
    }