Example #1
0
 @Override
 public void onSuccess(TaskRunner2Result result) {
   knownTasks.remove(taskWrapper.getRequestId());
   taskWrapper.setIsInPreemptableQueue(false);
   taskWrapper.maybeUnregisterForFinishedStateNotifications();
   taskWrapper.getTaskRunnerCallable().getCallback().onSuccess(result);
   updatePreemptionListAndNotify(result.getEndReason());
 }
Example #2
0
    // Errors are handled on the way over. FAIL/SUCCESS is informed via regular heartbeats. Killed
    // via a kill message when a task kill is requested by the daemon.
    @Override
    public void onSuccess(TaskRunner2Result result) {
      isCompleted.set(true);

      switch (result.getEndReason()) {
          // Only the KILLED case requires a message to be sent out to the AM.
        case SUCCESS:
          LOG.debug("Successfully finished {}", requestId);
          metrics.incrExecutorTotalSuccess();
          break;
        case CONTAINER_STOP_REQUESTED:
          LOG.info("Received container stop request (AM preemption) for {}", requestId);
          break;
        case KILL_REQUESTED:
          LOG.info("Killed task {}", requestId);
          if (killtimerWatch.isRunning()) {
            killtimerWatch.stop();
            long elapsed = killtimerWatch.elapsedMillis();
            LOG.info("Time to die for task {}", elapsed);
          }
          metrics.incrPreemptionTimeLost(runtimeWatch.elapsedMillis());
          metrics.incrExecutorTotalKilled();
          break;
        case COMMUNICATION_FAILURE:
          LOG.info("Failed to run {} due to communication failure", requestId);
          metrics.incrExecutorTotalExecutionFailed();
          break;
        case TASK_ERROR:
          LOG.info("Failed to run {} due to task error", requestId);
          metrics.incrExecutorTotalExecutionFailed();
          break;
      }
      fragmentCompletionHanler.fragmentComplete(fragmentInfo);

      taskRunnerCallable.shutdown();
      HistoryLogger.logFragmentEnd(
          request.getApplicationIdString(),
          request.getContainerIdString(),
          executionContext.getHostName(),
          request.getFragmentSpec().getDagName(),
          request.getFragmentSpec().getVertexName(),
          request.getFragmentSpec().getFragmentNumber(),
          request.getFragmentSpec().getAttemptNumber(),
          taskRunnerCallable.threadName,
          taskRunnerCallable.startTime,
          true);
      metrics.decrExecutorNumQueuedRequests();
    }