public static ExecutionState getAggregateJobVertexState ( int [ ] verticesPerState , int parallelism ) { if ( verticesPerState == null || verticesPerState . length != ExecutionState . values ( ) . length ) { throw new IllegalArgumentException ( "Must provide an array as large as there are execution states." ) ; } if ( verticesPerState [ ExecutionState . FAILED . ordinal ( ) ] > 0 ) { return ExecutionState . FAILED ; } if ( verticesPerState [ ExecutionState . CANCELING . ordinal ( ) ] > 0 ) { return ExecutionState . CANCELING ; } else if ( verticesPerState [ ExecutionState . CANCELED . ordinal ( ) ] > 0 ) { return ExecutionState . CANCELED ; } else if ( verticesPerState [ ExecutionState . RUNNING . ordinal ( ) ] > 0 ) { return ExecutionState . RUNNING ; } else if ( verticesPerState [ ExecutionState . FINISHED . ordinal ( ) ] > 0 ) { return verticesPerState [ ExecutionState . FINISHED . ordinal ( ) ] == parallelism ? ExecutionState . FINISHED : ExecutionState . RUNNING ; } else { // all else collapses under created return ExecutionState . CREATED ; } }
A utility function that computes an aggregated state for the vertex .