use of org.apache.flink.api.common.accumulators.Accumulator in project flink by apache.
the class ExecutionGraphDeploymentTest method testAccumulatorsAndMetricsStorage.
/**
* Verifies that {@link Execution#cancelingComplete(Map, IOMetrics)} and {@link Execution#markFailed(Throwable, Map, IOMetrics)}
* store the given accumulators and metrics correctly.
*/
@Test
public void testAccumulatorsAndMetricsStorage() throws Exception {
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, 1, v2, 1).f1;
IOMetrics ioMetrics = new IOMetrics(0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0);
Map<String, Accumulator<?, ?>> accumulators = Collections.emptyMap();
Execution execution1 = executions.values().iterator().next();
execution1.cancel();
execution1.cancelingComplete(accumulators, ioMetrics);
assertEquals(ioMetrics, execution1.getIOMetrics());
assertEquals(accumulators, execution1.getUserAccumulators());
Execution execution2 = executions.values().iterator().next();
execution2.markFailed(new Throwable(), accumulators, ioMetrics);
assertEquals(ioMetrics, execution2.getIOMetrics());
assertEquals(accumulators, execution2.getUserAccumulators());
}
Aggregations