Exemple #1
0
  @Override
  public void statusUpdate(SchedulerDriver schedulerDriver, Protos.TaskStatus taskStatus) {
    LOGGER.info(
        "Status update : Task ID "
            + taskStatus.getTaskId().getValue()
            + "in state : "
            + taskStatus.getState().getValueDescriptor().getName());
    if (taskStatus.getState() == Protos.TaskState.TASK_FINISHED) {
      finishedTasks++;
      LOGGER.info("Finished tasks : " + finishedTasks);
      if (finishedTasks == totalTasks) {
        schedulerDriver.stop();
      }
    }

    if (taskStatus.getState() == Protos.TaskState.TASK_FAILED
        || taskStatus.getState() == Protos.TaskState.TASK_KILLED
        || taskStatus.getState() == Protos.TaskState.TASK_LOST) {
      LOGGER.error(
          "Aborting because the task "
              + taskStatus.getTaskId().getValue()
              + " is in unexpected state : "
              + taskStatus.getState().getValueDescriptor().getName()
              + "with reason : "
              + taskStatus.getReason().getValueDescriptor().getName()
              + " from source : "
              + taskStatus.getSource().getValueDescriptor().getName()
              + " with message : "
              + taskStatus.getMessage());
      schedulerDriver.abort();
    }
  }
  @Override
  public void statusUpdate(SchedulerDriver driver, Protos.TaskStatus status) {
    String taskId = status.getTaskId().getValue();
    Protos.TaskState state = status.getState();
    LOG.info("Task {} is in state {}", taskId, state);
    // TODO(jiri): Handle the case when an Alluxio master and/or worker task fails.
    // In particular, we should enable support for the fault tolerant mode of Alluxio to account
    // for Alluxio master process failures and keep track of the running number of Alluxio
    // masters.

    switch (status.getState()) {
      case TASK_FAILED: // intend to fall through
      case TASK_LOST: // intend to fall through
      case TASK_ERROR:
        if (status.getTaskId().getValue().equals(String.valueOf(mMasterTaskId))) {
          mMasterCount--;
        }
        break;
      case TASK_RUNNING:
        if (status.getTaskId().getValue().equals(String.valueOf(mMasterTaskId))) {
          mMasterLaunched = true;
        }
        break;
      default:
        break;
    }
  }