コード例 #1
0
  @Test
  public void testRegistrationOfExecutionsFailingFinalize() {
    try {

      final JobVertexID jid1 = new JobVertexID();
      final JobVertexID jid2 = new JobVertexID();

      JobVertex v1 = new FailingFinalizeJobVertex("v1", jid1);
      JobVertex v2 = new JobVertex("v2", jid2);

      Map<ExecutionAttemptID, Execution> executions = setupExecution(v1, 6, v2, 4);

      List<Execution> execList = new ArrayList<Execution>();
      execList.addAll(executions.values());
      // sort executions by job vertex. Failing job vertex first
      Collections.sort(
          execList,
          new Comparator<Execution>() {
            @Override
            public int compare(Execution o1, Execution o2) {
              return o1.getVertex().getSimpleName().compareTo(o2.getVertex().getSimpleName());
            }
          });

      int cnt = 0;
      for (Execution e : execList) {
        cnt++;
        e.markFinished();
        if (cnt <= 6) {
          // the last execution of the first job vertex triggers the failing finalize hook
          assertEquals(ExecutionState.FINISHED, e.getState());
        } else {
          // all following executions should be canceled
          assertEquals(ExecutionState.CANCELED, e.getState());
        }
      }

      assertEquals(0, executions.size());
    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
    }
  }
コード例 #2
0
  @Test
  public void testRegistrationOfExecutionsFinishing() {
    try {
      final JobVertexID jid1 = new JobVertexID();
      final JobVertexID jid2 = new JobVertexID();

      JobVertex v1 = new JobVertex("v1", jid1);
      JobVertex v2 = new JobVertex("v2", jid2);

      Map<ExecutionAttemptID, Execution> executions = setupExecution(v1, 7650, v2, 2350);

      for (Execution e : executions.values()) {
        e.markFinished();
      }

      assertEquals(0, executions.size());
    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
    }
  }
コード例 #3
0
ファイル: Execution.java プロジェクト: f-sander/flink
 void markFinished() {
   markFinished(null, null);
 }