public boolean updateState ( TaskExecutionState state ) { assertRunningInJobMasterMainThread ( ) ; final Execution attempt = currentExecutions . get ( state . getID ( ) ) ; if ( attempt != null ) { try { Map < String , Accumulator < ? , ? > > accumulators ; switch ( state . getExecutionState ( ) ) { case RUNNING : return attempt . switchToRunning ( ) ; case FINISHED : // this deserialization is exception-free accumulators = deserializeAccumulators ( state ) ; attempt . markFinished ( accumulators , state . getIOMetrics ( ) ) ; return true ; case CANCELED : // this deserialization is exception-free accumulators = deserializeAccumulators ( state ) ; attempt . completeCancelling ( accumulators , state . getIOMetrics ( ) ) ; return true ; case FAILED : // this deserialization is exception-free accumulators = deserializeAccumulators ( state ) ; attempt . markFailed ( state . getError ( userClassLoader ) , accumulators , state . getIOMetrics ( ) ) ; return true ; default : // we mark as failed and return false, which triggers the TaskManager // to remove the task attempt . fail ( new Exception ( "TaskManager sent illegal state update: " + state . getExecutionState ( ) ) ) ; return false ; } } catch ( Throwable t ) { ExceptionUtils . rethrowIfFatalErrorOrOOM ( t ) ; // failures during updates leave the ExecutionGraph inconsistent failGlobal ( t ) ; return false ; } } else { return false ; } }
Updates the state of one of the ExecutionVertex s Execution attempts . If the new status if FINISHED this also updates the accumulators .