use of org.apache.flink.runtime.executiongraph.AccessExecutionGraph in project flink by apache.
the class CheckpointConfigHandlerTest method testAtLeastOnce.
/**
* Tests the that the isExactlyOnce flag is respected.
*/
@Test
public void testAtLeastOnce() throws Exception {
GraphAndSettings graphAndSettings = createGraphAndSettings(false, false);
AccessExecutionGraph graph = graphAndSettings.graph;
CheckpointConfigHandler handler = new CheckpointConfigHandler(mock(ExecutionGraphHolder.class));
String json = handler.handleRequest(graph, Collections.<String, String>emptyMap());
ObjectMapper mapper = new ObjectMapper();
JsonNode rootNode = mapper.readTree(json);
assertEquals("at_least_once", rootNode.get("mode").asText());
}
use of org.apache.flink.runtime.executiongraph.AccessExecutionGraph in project flink by apache.
the class SubtasksTimesHandlerTest method testArchiver.
@Test
public void testArchiver() throws Exception {
JsonArchivist archivist = new SubtasksTimesHandler.SubtasksTimesJsonArchivist();
AccessExecutionGraph originalJob = ArchivedJobGenerationUtils.getTestJob();
AccessExecutionJobVertex originalTask = ArchivedJobGenerationUtils.getTestTask();
AccessExecution originalAttempt = ArchivedJobGenerationUtils.getTestAttempt();
Collection<ArchivedJson> archives = archivist.archiveJsonWithPath(originalJob);
Assert.assertEquals(1, archives.size());
ArchivedJson archive = archives.iterator().next();
Assert.assertEquals("/jobs/" + originalJob.getJobID() + "/vertices/" + originalTask.getJobVertexId() + "/subtasktimes", archive.getPath());
compareSubtaskTimes(originalTask, originalAttempt, archive.getJson());
}
use of org.apache.flink.runtime.executiongraph.AccessExecutionGraph in project flink by apache.
the class CheckpointConfigHandlerTest method testSimpleConfig.
/**
* Tests a simple config.
*/
@Test
public void testSimpleConfig() throws Exception {
GraphAndSettings graphAndSettings = createGraphAndSettings(false, true);
AccessExecutionGraph graph = graphAndSettings.graph;
JobSnapshottingSettings settings = graphAndSettings.snapshottingSettings;
CheckpointConfigHandler handler = new CheckpointConfigHandler(mock(ExecutionGraphHolder.class));
String json = handler.handleRequest(graph, Collections.<String, String>emptyMap());
ObjectMapper mapper = new ObjectMapper();
JsonNode rootNode = mapper.readTree(json);
assertEquals("exactly_once", rootNode.get("mode").asText());
assertEquals(settings.getCheckpointInterval(), rootNode.get("interval").asLong());
assertEquals(settings.getCheckpointTimeout(), rootNode.get("timeout").asLong());
assertEquals(settings.getMinPauseBetweenCheckpoints(), rootNode.get("min_pause").asLong());
assertEquals(settings.getMaxConcurrentCheckpoints(), rootNode.get("max_concurrent").asInt());
JsonNode externalizedNode = rootNode.get("externalization");
assertNotNull(externalizedNode);
assertEquals(false, externalizedNode.get("enabled").asBoolean());
}
use of org.apache.flink.runtime.executiongraph.AccessExecutionGraph in project flink by apache.
the class CheckpointConfigHandlerTest method testEnabledExternalizedCheckpointSettings.
/**
* Tests that the externalized checkpoint settings are forwarded.
*/
@Test
public void testEnabledExternalizedCheckpointSettings() throws Exception {
GraphAndSettings graphAndSettings = createGraphAndSettings(true, false);
AccessExecutionGraph graph = graphAndSettings.graph;
ExternalizedCheckpointSettings externalizedSettings = graphAndSettings.externalizedSettings;
CheckpointConfigHandler handler = new CheckpointConfigHandler(mock(ExecutionGraphHolder.class));
String json = handler.handleRequest(graph, Collections.<String, String>emptyMap());
ObjectMapper mapper = new ObjectMapper();
JsonNode externalizedNode = mapper.readTree(json).get("externalization");
assertNotNull(externalizedNode);
assertEquals(externalizedSettings.externalizeCheckpoints(), externalizedNode.get("enabled").asBoolean());
assertEquals(externalizedSettings.deleteOnCancellation(), externalizedNode.get("delete_on_cancellation").asBoolean());
}
use of org.apache.flink.runtime.executiongraph.AccessExecutionGraph in project flink by apache.
the class CheckpointConfigHandlerTest method testArchiver.
@Test
public void testArchiver() throws IOException {
JsonArchivist archivist = new CheckpointConfigHandler.CheckpointConfigJsonArchivist();
GraphAndSettings graphAndSettings = createGraphAndSettings(true, true);
AccessExecutionGraph graph = graphAndSettings.graph;
when(graph.getJobID()).thenReturn(new JobID());
JobSnapshottingSettings settings = graphAndSettings.snapshottingSettings;
ExternalizedCheckpointSettings externalizedSettings = graphAndSettings.externalizedSettings;
Collection<ArchivedJson> archives = archivist.archiveJsonWithPath(graph);
Assert.assertEquals(1, archives.size());
ArchivedJson archive = archives.iterator().next();
Assert.assertEquals("/jobs/" + graph.getJobID() + "/checkpoints/config", archive.getPath());
ObjectMapper mapper = new ObjectMapper();
JsonNode rootNode = mapper.readTree(archive.getJson());
Assert.assertEquals("exactly_once", rootNode.get("mode").asText());
Assert.assertEquals(settings.getCheckpointInterval(), rootNode.get("interval").asLong());
Assert.assertEquals(settings.getCheckpointTimeout(), rootNode.get("timeout").asLong());
Assert.assertEquals(settings.getMinPauseBetweenCheckpoints(), rootNode.get("min_pause").asLong());
Assert.assertEquals(settings.getMaxConcurrentCheckpoints(), rootNode.get("max_concurrent").asInt());
JsonNode externalizedNode = rootNode.get("externalization");
Assert.assertNotNull(externalizedNode);
Assert.assertEquals(externalizedSettings.externalizeCheckpoints(), externalizedNode.get("enabled").asBoolean());
Assert.assertEquals(externalizedSettings.deleteOnCancellation(), externalizedNode.get("delete_on_cancellation").asBoolean());
}
Aggregations