Java Code Examples for org.apache.tez.dag.api.client.DAGStatus#State

The following examples show how to use org.apache.tez.dag.api.client.DAGStatus#State . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestDAGRecovery2.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
void runDAGAndVerify(DAG dag, DAGStatus.State finalState,
                     TezClient session) throws Exception {
  session.waitTillReady();
  DAGClient dagClient = session.submitDAG(dag);
  DAGStatus dagStatus = dagClient.getDAGStatus(null);
  while (!dagStatus.isCompleted()) {
    LOG.info("Waiting for dag to complete. Sleeping for 500ms."
        + " DAG name: " + dag.getName()
        + " DAG appId: " + dagClient.getApplicationId()
        + " Current state: " + dagStatus.getState());
    Thread.sleep(100);
    dagStatus = dagClient.getDAGStatus(null);
  }

  Assert.assertEquals(finalState, dagStatus.getState());
}
 
Example 2
Source File: DAGImpl.java    From incubator-tez with Apache License 2.0 6 votes vote down vote up
private DAGStatus.State getDAGStatusFromState(DAGState finalState) {
  switch (finalState) {
    case NEW:
      return DAGStatus.State.INITING;
    case INITED:
      return DAGStatus.State.INITING;
    case RUNNING:
      return DAGStatus.State.RUNNING;
    case SUCCEEDED:
      return DAGStatus.State.SUCCEEDED;
    case FAILED:
      return DAGStatus.State.FAILED;
    case KILLED:
      return DAGStatus.State.KILLED;
    case ERROR:
      return DAGStatus.State.ERROR;
    case TERMINATING:
      return DAGStatus.State.KILLED;
    default:
      throw new TezUncheckedException("Unknown DAGState: " + finalState);
  }
}
 
Example 3
Source File: TestFaultTolerance.java    From tez with Apache License 2.0 6 votes vote down vote up
void runDAGAndVerify(DAG dag, DAGStatus.State finalState, int checkFailedAttempts, 
    String diagnostics) throws Exception {
  tezSession.waitTillReady();
  DAGClient dagClient = tezSession.submitDAG(dag);
  DAGStatus dagStatus = dagClient.getDAGStatus(null);
  while (!dagStatus.isCompleted()) {
    LOG.info("Waiting for dag to complete. Sleeping for 500ms."
        + " DAG name: " + dag.getName()
        + " DAG appContext: " + dagClient.getExecutionContext()
        + " Current state: " + dagStatus.getState());
    Thread.sleep(100);
    dagStatus = dagClient.getDAGStatus(null);
  }

  Assert.assertEquals(finalState, dagStatus.getState());
  
  if (checkFailedAttempts > 0) {
    Assert.assertEquals(checkFailedAttempts,
        dagStatus.getDAGProgress().getFailedTaskAttemptCount());
  }

  if (diagnostics != null) {
    Assert.assertNotNull(dagStatus.getDiagnostics());
    Assert.assertTrue(Joiner.on(":").join(dagStatus.getDiagnostics()).contains(diagnostics));
  }
}
 
Example 4
Source File: TestDAGRecovery2.java    From tez with Apache License 2.0 6 votes vote down vote up
void runDAGAndVerify(DAG dag, DAGStatus.State finalState,
                     TezClient session) throws Exception {
  session.waitTillReady();
  DAGClient dagClient = session.submitDAG(dag);
  DAGStatus dagStatus = dagClient.getDAGStatus(null);
  while (!dagStatus.isCompleted()) {
    LOG.info("Waiting for dag to complete. Sleeping for 500ms."
        + " DAG name: " + dag.getName()
        + " DAG appContext: " + dagClient.getExecutionContext()
        + " Current state: " + dagStatus.getState());
    Thread.sleep(100);
    dagStatus = dagClient.getDAGStatus(null);
  }

  Assert.assertEquals(finalState, dagStatus.getState());
}
 
Example 5
Source File: TestAnalyzer.java    From tez with Apache License 2.0 6 votes vote down vote up
private void runDAG(DAG dag, DAGStatus.State finalState) throws Exception {
  tezSession.waitTillReady();
  LOG.info("ABC Running DAG name: " + dag.getName());
  DAGClient dagClient = tezSession.submitDAG(dag);
  DAGStatus dagStatus = dagClient.getDAGStatus(null);
  while (!dagStatus.isCompleted()) {
    LOG.info("Waiting for dag to complete. Sleeping for 500ms."
        + " DAG name: " + dag.getName()
        + " DAG appContext: " + dagClient.getExecutionContext()
        + " Current state: " + dagStatus.getState());
    Thread.sleep(100);
    dagStatus = dagClient.getDAGStatus(null);
  }

  Assert.assertEquals(finalState, dagStatus.getState());
}
 
Example 6
Source File: TestFaultTolerance.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
void runDAGAndVerify(DAG dag, DAGStatus.State finalState) throws Exception {
  tezSession.waitTillReady();
  DAGClient dagClient = tezSession.submitDAG(dag);
  DAGStatus dagStatus = dagClient.getDAGStatus(null);
  while (!dagStatus.isCompleted()) {
    LOG.info("Waiting for dag to complete. Sleeping for 500ms."
        + " DAG name: " + dag.getName()
        + " DAG appId: " + dagClient.getApplicationId()
        + " Current state: " + dagStatus.getState());
    Thread.sleep(100);
    dagStatus = dagClient.getDAGStatus(null);
  }
  
  Assert.assertEquals(finalState, dagStatus.getState());
}
 
Example 7
Source File: TestDAGRecovery.java    From incubator-tez with Apache License 2.0 5 votes vote down vote up
void runDAGAndVerify(DAG dag, DAGStatus.State finalState) throws Exception {
  tezSession.waitTillReady();
  DAGClient dagClient = tezSession.submitDAG(dag);
  DAGStatus dagStatus = dagClient.getDAGStatus(null);
  while (!dagStatus.isCompleted()) {
    LOG.info("Waiting for dag to complete. Sleeping for 500ms."
        + " DAG name: " + dag.getName()
        + " DAG appId: " + dagClient.getApplicationId()
        + " Current state: " + dagStatus.getState());
    Thread.sleep(100);
    dagStatus = dagClient.getDAGStatus(null);
  }

  Assert.assertEquals(finalState, dagStatus.getState());
}
 
Example 8
Source File: TestAMRecovery.java    From tez with Apache License 2.0 5 votes vote down vote up
TezCounters runDAGAndVerify(DAG dag, DAGStatus.State finalState) throws Exception {
  tezSession.waitTillReady();
  DAGClient dagClient = tezSession.submitDAG(dag);
  DAGStatus dagStatus =
      dagClient.waitForCompletionWithStatusUpdates(EnumSet
          .of(StatusGetOpts.GET_COUNTERS));
  Assert.assertEquals(finalState, dagStatus.getState());
  return dagStatus.getDAGCounters();
}
 
Example 9
Source File: TestDAGRecovery.java    From tez with Apache License 2.0 5 votes vote down vote up
void runDAGAndVerify(DAG dag, DAGStatus.State finalState) throws Exception {
  tezSession.waitTillReady();
  DAGClient dagClient = tezSession.submitDAG(dag);
  DAGStatus dagStatus = dagClient.getDAGStatus(null, 10);
  while (!dagStatus.isCompleted()) {
    LOG.info("Waiting for dag to complete. Sleeping for 500ms."
        + " DAG name: " + dag.getName()
        + " DAG appContext: " + dagClient.getExecutionContext()
        + " Current state: " + dagStatus.getState());
    Thread.sleep(100);
    dagStatus = dagClient.getDAGStatus(null);
  }

  Assert.assertEquals(finalState, dagStatus.getState());
}
 
Example 10
Source File: TestDAGRecovery2.java    From incubator-tez with Apache License 2.0 4 votes vote down vote up
void runDAGAndVerify(DAG dag, DAGStatus.State finalState) throws Exception {
  runDAGAndVerify(dag, finalState, tezSession);
}
 
Example 11
Source File: TestFaultTolerance.java    From tez with Apache License 2.0 4 votes vote down vote up
void runDAGAndVerify(DAG dag, DAGStatus.State finalState) throws Exception {
  runDAGAndVerify(dag, finalState, -1);
}
 
Example 12
Source File: TestFaultTolerance.java    From tez with Apache License 2.0 4 votes vote down vote up
void runDAGAndVerify(DAG dag, DAGStatus.State finalState, int checkFailedAttempts) throws Exception {
  runDAGAndVerify(dag, finalState, checkFailedAttempts, null);
}
 
Example 13
Source File: TestDAGRecovery2.java    From tez with Apache License 2.0 4 votes vote down vote up
void runDAGAndVerify(DAG dag, DAGStatus.State finalState) throws Exception {
  runDAGAndVerify(dag, finalState, tezSession);
}