private void onContainerStatus(final ContainerStatus value) {

    final String containerId = value.getContainerId().toString();
    final boolean hasContainer = this.containers.hasContainer(containerId);

    if (hasContainer) {
      LOG.log(Level.FINE, "Received container status: {0}", containerId);

      final ResourceStatusEventImpl.Builder status =
          ResourceStatusEventImpl.newBuilder().setIdentifier(containerId);

      switch (value.getState()) {
      case COMPLETE:
        LOG.log(Level.FINE, "Container completed: status {0}", value.getExitStatus());
        switch (value.getExitStatus()) {
        case 0:
          status.setState(State.DONE);
          break;
        case 143:
          status.setState(State.KILLED);
          break;
        default:
          status.setState(State.FAILED);
        }
        status.setExitCode(value.getExitStatus());
        break;
      default:
        LOG.info("Container running");
        status.setState(State.RUNNING);
      }

      if (value.getDiagnostics() != null) {
        LOG.log(Level.FINE, "Container diagnostics: {0}", value.getDiagnostics());
        status.setDiagnostics(value.getDiagnostics());
      }

      // ResourceStatusHandler should close and release the Evaluator for us if the state is a terminal state.
      this.reefEventHandlers.onResourceStatus(status.build());
    }
  }
private void onContainerStatus ( final ContainerStatus value ) { final String containerId = value . getContainerId ( ) . toString ( ) ; final boolean hasContainer = this . containers . hasContainer ( containerId ) ; if ( hasContainer ) { LOG . log ( Level . FINE , "Received container status: {0}" , containerId ) ; final ResourceStatusEventImpl . Builder status = ResourceStatusEventImpl . newBuilder ( ) . setIdentifier ( containerId ) ; switch ( value . getState ( ) ) { case COMPLETE : LOG . log ( Level . FINE , "Container completed: status {0}" , value . getExitStatus ( ) ) ; switch ( value . getExitStatus ( ) ) { case 0 : status . setState ( State . DONE ) ; break ; case 143 : status . setState ( State . KILLED ) ; break ; default : status . setState ( State . FAILED ) ; } status . setExitCode ( value . getExitStatus ( ) ) ; break ; default : LOG . info ( "Container running" ) ; status . setState ( State . RUNNING ) ; } if ( value . getDiagnostics ( ) != null ) { LOG . log ( Level . FINE , "Container diagnostics: {0}" , value . getDiagnostics ( ) ) ; status . setDiagnostics ( value . getDiagnostics ( ) ) ; } this . reefEventHandlers . onResourceStatus ( status . build ( ) ) ; } }
Handles container status reports. Calls come from YARN.
@param value containing the container status.