protected void handleMesosStatusUpdate(String taskId,
                                         Protos.TaskStatus status) {
    // We would determine what to do basing on current taskId and mesos status update
    switch (status.getState()) {
      case TASK_STAGING:
        LOG.info(String.format("Task with id '%s' STAGING", status.getTaskId().getValue()));
        LOG.severe("Framework status updates should not use");

        break;
      case TASK_STARTING:
        LOG.info(String.format("Task with id '%s' STARTING", status.getTaskId().getValue()));

        break;
      case TASK_RUNNING:
        LOG.info(String.format("Task with id '%s' RUNNING", status.getTaskId().getValue()));

        break;
      case TASK_FINISHED:
        LOG.info(String.format("Task with id '%s' FINISHED", status.getTaskId().getValue()));
        LOG.severe("Heron job should not finish!");

        break;
      case TASK_FAILED:
        LOG.info(String.format("Task with id '%s' FAILED", status.getTaskId().getValue()));
        handleMesosFailure(taskId);

        break;
      case TASK_KILLED:
        LOG.info("Task killed which is supported running. "
            + "It could be triggered by manual restart command");
        handleMesosFailure(taskId);

        break;
      case TASK_LOST:
        LOG.info(String.format("Task with id '%s' LOST", status.getTaskId().getValue()));
        handleMesosFailure(taskId);

        break;
      case TASK_ERROR:
        LOG.info(String.format("Task with id '%s' ERROR", status.getTaskId().getValue()));
        handleMesosFailure(taskId);

        break;
      default:
        LOG.severe("Unknown TaskState:" + status.getState() + " for taskId: "
            + status.getTaskId().getValue());

        break;
    }
  }
protected void handleMesosStatusUpdate ( String taskId , Protos . TaskStatus status ) { switch ( status . getState ( ) ) { case TASK_STAGING : LOG . info ( String . format ( "Task with id '%s' STAGING" , status . getTaskId ( ) . getValue ( ) ) ) ; LOG . severe ( "Framework status updates should not use" ) ; break ; case TASK_STARTING : LOG . info ( String . format ( "Task with id '%s' STARTING" , status . getTaskId ( ) . getValue ( ) ) ) ; break ; case TASK_RUNNING : LOG . info ( String . format ( "Task with id '%s' RUNNING" , status . getTaskId ( ) . getValue ( ) ) ) ; break ; case TASK_FINISHED : LOG . info ( String . format ( "Task with id '%s' FINISHED" , status . getTaskId ( ) . getValue ( ) ) ) ; LOG . severe ( "Heron job should not finish!" ) ; break ; case TASK_FAILED : LOG . info ( String . format ( "Task with id '%s' FAILED" , status . getTaskId ( ) . getValue ( ) ) ) ; handleMesosFailure ( taskId ) ; break ; case TASK_KILLED : LOG . info ( "Task killed which is supported running. " + "It could be triggered by manual restart command" ) ; handleMesosFailure ( taskId ) ; break ; case TASK_LOST : LOG . info ( String . format ( "Task with id '%s' LOST" , status . getTaskId ( ) . getValue ( ) ) ) ; handleMesosFailure ( taskId ) ; break ; case TASK_ERROR : LOG . info ( String . format ( "Task with id '%s' ERROR" , status . getTaskId ( ) . getValue ( ) ) ) ; handleMesosFailure ( taskId ) ; break ; default : LOG . severe ( "Unknown TaskState:" + status . getState ( ) + " for taskId: " + status . getTaskId ( ) . getValue ( ) ) ; break ; } }
Handle status update from mesos master
1. It does nothing except logging under states:
- TASK_STAGING,
- TASK_STARTING,
- TASK_RUNNING,
<p>
2. It does severe logging under states:
- TASK_FINISHED
since heron-executor should be long live in normal production running.
This state can occur during DEBUG mode. And we would not consider it as failure.
<p>
3. It considers the task a failure and tries to restart it under states:
- TASK_FAILED
- TASK_KILLED
- TASK_LOST
- TASK_ERROR

@param taskId the taskId of container to handle
@param status the TasksStatus to handle