@Test public void testVertexStateConversion() { for (VertexState state : VertexState.values()) { DAGProtos.VertexStatusStateProto stateProto = VertexStatusBuilder.getProtoState(state); VertexStatus.State clientState = VertexStatus.getState(stateProto); if (state.equals(VertexState.RECOVERING)) { Assert.assertEquals(clientState.name(), State.NEW.name()); } else { Assert.assertEquals(state.name(), clientState.name()); } } }
@VisibleForTesting static VertexStatusStateProto getProtoState(VertexState state) { switch(state) { case NEW: return VertexStatusStateProto.VERTEX_NEW; case INITIALIZING: return VertexStatusStateProto.VERTEX_INITIALIZING; case RECOVERING: return VertexStatusStateProto.VERTEX_NEW; case INITED: return VertexStatusStateProto.VERTEX_INITED; case RUNNING: return VertexStatusStateProto.VERTEX_RUNNING; case SUCCEEDED: return VertexStatusStateProto.VERTEX_SUCCEEDED; case FAILED: return VertexStatusStateProto.VERTEX_FAILED; case KILLED: return VertexStatusStateProto.VERTEX_KILLED; case TERMINATING: return VertexStatusStateProto.VERTEX_TERMINATING; case ERROR: return VertexStatusStateProto.VERTEX_ERROR; default: throw new TezUncheckedException("Unsupported value for VertexState : " + state); } }
VertexStatusBuilder extends VertexStatus { @VisibleForTesting static VertexStatusStateProto getProtoState(VertexState state) { switch(state) { case NEW: return VertexStatusStateProto.VERTEX_NEW; case INITIALIZING: return VertexStatusStateProto.VERTEX_INITIALIZING; case RECOVERING: return VertexStatusStateProto.VERTEX_NEW; case INITED: return VertexStatusStateProto.VERTEX_INITED; case RUNNING: return VertexStatusStateProto.VERTEX_RUNNING; case SUCCEEDED: return VertexStatusStateProto.VERTEX_SUCCEEDED; case FAILED: return VertexStatusStateProto.VERTEX_FAILED; case KILLED: return VertexStatusStateProto.VERTEX_KILLED; case TERMINATING: return VertexStatusStateProto.VERTEX_TERMINATING; case ERROR: return VertexStatusStateProto.VERTEX_ERROR; default: throw new TezUncheckedException("Unsupported value for VertexState : " + state); } } }
VertexStatusBuilder extends VertexStatus { @VisibleForTesting static VertexStatusStateProto getProtoState(VertexState state) { switch(state) { case NEW: return VertexStatusStateProto.VERTEX_NEW; case INITIALIZING: return VertexStatusStateProto.VERTEX_INITIALIZING; case RECOVERING: return VertexStatusStateProto.VERTEX_NEW; case INITED: return VertexStatusStateProto.VERTEX_INITED; case RUNNING: return VertexStatusStateProto.VERTEX_RUNNING; case SUCCEEDED: return VertexStatusStateProto.VERTEX_SUCCEEDED; case FAILED: return VertexStatusStateProto.VERTEX_FAILED; case KILLED: return VertexStatusStateProto.VERTEX_KILLED; case TERMINATING: return VertexStatusStateProto.VERTEX_TERMINATING; case ERROR: return VertexStatusStateProto.VERTEX_ERROR; default: throw new TezUncheckedException("Unsupported value for VertexState : " + state); } } VertexStatusBuilder(); }
VertexStatusBuilder extends VertexStatus { @VisibleForTesting static VertexStatusStateProto getProtoState(VertexState state) { switch(state) { case NEW: return VertexStatusStateProto.VERTEX_NEW; case INITIALIZING: return VertexStatusStateProto.VERTEX_INITIALIZING; case RECOVERING: return VertexStatusStateProto.VERTEX_NEW; case INITED: return VertexStatusStateProto.VERTEX_INITED; case RUNNING: return VertexStatusStateProto.VERTEX_RUNNING; case SUCCEEDED: return VertexStatusStateProto.VERTEX_SUCCEEDED; case FAILED: return VertexStatusStateProto.VERTEX_FAILED; case KILLED: return VertexStatusStateProto.VERTEX_KILLED; case TERMINATING: return VertexStatusStateProto.VERTEX_TERMINATING; case ERROR: return VertexStatusStateProto.VERTEX_ERROR; default: throw new TezUncheckedException("Unsupported value for VertexState : " + state); } } VertexStatusBuilder(); void setState(VertexState state); void setDiagnostics(List<String> diagnostics); void setProgress(ProgressBuilder progress); void setVertexCounters(TezCounters counters); VertexStatusProto getProto(); }
VertexStatusBuilder extends VertexStatus { @VisibleForTesting static VertexStatusStateProto getProtoState(VertexState state) { switch(state) { case NEW: return VertexStatusStateProto.VERTEX_NEW; case INITIALIZING: return VertexStatusStateProto.VERTEX_INITIALIZING; case RECOVERING: return VertexStatusStateProto.VERTEX_NEW; case INITED: return VertexStatusStateProto.VERTEX_INITED; case RUNNING: return VertexStatusStateProto.VERTEX_RUNNING; case SUCCEEDED: return VertexStatusStateProto.VERTEX_SUCCEEDED; case FAILED: return VertexStatusStateProto.VERTEX_FAILED; case KILLED: return VertexStatusStateProto.VERTEX_KILLED; case TERMINATING: return VertexStatusStateProto.VERTEX_TERMINATING; case ERROR: return VertexStatusStateProto.VERTEX_ERROR; default: throw new TezUncheckedException("Unsupported value for VertexState : " + state); } } VertexStatusBuilder(); void setState(VertexState state); void setDiagnostics(List<String> diagnostics); void setProgress(ProgressBuilder progress); void setVertexCounters(TezCounters counters); VertexStatusProto getProto();  }