Search in sources :

Example 6 with ArchivedJson

use of org.apache.flink.runtime.webmonitor.history.ArchivedJson 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());
}
Also used : AccessExecutionJobVertex(org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex) JsonArchivist(org.apache.flink.runtime.webmonitor.history.JsonArchivist) AccessExecution(org.apache.flink.runtime.executiongraph.AccessExecution) ArchivedJson(org.apache.flink.runtime.webmonitor.history.ArchivedJson) AccessExecutionGraph(org.apache.flink.runtime.executiongraph.AccessExecutionGraph) Test(org.junit.Test)

Example 7 with ArchivedJson

use of org.apache.flink.runtime.webmonitor.history.ArchivedJson 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());
}
Also used : JsonArchivist(org.apache.flink.runtime.webmonitor.history.JsonArchivist) ArchivedJson(org.apache.flink.runtime.webmonitor.history.ArchivedJson) ExternalizedCheckpointSettings(org.apache.flink.runtime.jobgraph.tasks.ExternalizedCheckpointSettings) JobSnapshottingSettings(org.apache.flink.runtime.jobgraph.tasks.JobSnapshottingSettings) AccessExecutionGraph(org.apache.flink.runtime.executiongraph.AccessExecutionGraph) JsonNode(com.fasterxml.jackson.databind.JsonNode) JobID(org.apache.flink.api.common.JobID) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 8 with ArchivedJson

use of org.apache.flink.runtime.webmonitor.history.ArchivedJson in project flink by apache.

the class CheckpointStatsSubtaskDetailsHandlerTest method testArchiver.

@Test
public void testArchiver() throws Exception {
    JsonArchivist archivist = new CheckpointStatsDetailsSubtasksHandler.CheckpointStatsDetailsSubtasksJsonArchivist();
    ObjectMapper mapper = new ObjectMapper();
    PendingCheckpointStats checkpoint = mock(PendingCheckpointStats.class);
    when(checkpoint.getCheckpointId()).thenReturn(1992139L);
    when(checkpoint.getStatus()).thenReturn(CheckpointStatsStatus.IN_PROGRESS);
    // ack timestamp = duration
    when(checkpoint.getTriggerTimestamp()).thenReturn(0L);
    TaskStateStats task = createTaskStateStats(1237);
    when(checkpoint.getAllTaskStateStats()).thenReturn(Collections.singletonList(task));
    CheckpointStatsHistory history = mock(CheckpointStatsHistory.class);
    when(history.getCheckpoints()).thenReturn(Collections.<AbstractCheckpointStats>singletonList(checkpoint));
    CheckpointStatsSnapshot snapshot = mock(CheckpointStatsSnapshot.class);
    when(snapshot.getHistory()).thenReturn(history);
    AccessExecutionGraph graph = mock(AccessExecutionGraph.class);
    when(graph.getCheckpointStatsSnapshot()).thenReturn(snapshot);
    when(graph.getJobID()).thenReturn(new JobID());
    Collection<ArchivedJson> archives = archivist.archiveJsonWithPath(graph);
    Assert.assertEquals(1, archives.size());
    ArchivedJson archive = archives.iterator().next();
    Assert.assertEquals("/jobs/" + graph.getJobID() + "/checkpoints/details/" + checkpoint.getCheckpointId() + "/subtasks/" + task.getJobVertexId(), archive.getPath());
    JsonNode rootNode = mapper.readTree(archive.getJson());
    assertEquals(checkpoint.getCheckpointId(), rootNode.get("id").asLong());
    assertEquals(checkpoint.getStatus().toString(), rootNode.get("status").asText());
    verifyTaskNode(rootNode, task, checkpoint.getTriggerTimestamp());
}
Also used : PendingCheckpointStats(org.apache.flink.runtime.checkpoint.PendingCheckpointStats) JsonArchivist(org.apache.flink.runtime.webmonitor.history.JsonArchivist) TaskStateStats(org.apache.flink.runtime.checkpoint.TaskStateStats) ArchivedJson(org.apache.flink.runtime.webmonitor.history.ArchivedJson) CheckpointStatsHistory(org.apache.flink.runtime.checkpoint.CheckpointStatsHistory) AccessExecutionGraph(org.apache.flink.runtime.executiongraph.AccessExecutionGraph) JsonNode(com.fasterxml.jackson.databind.JsonNode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) CheckpointStatsSnapshot(org.apache.flink.runtime.checkpoint.CheckpointStatsSnapshot) JobID(org.apache.flink.api.common.JobID) Test(org.junit.Test)

Example 9 with ArchivedJson

use of org.apache.flink.runtime.webmonitor.history.ArchivedJson in project flink by apache.

the class JobAccumulatorsHandlerTest method testArchiver.

@Test
public void testArchiver() throws Exception {
    JsonArchivist archivist = new JobAccumulatorsHandler.JobAccumulatorsJsonArchivist();
    AccessExecutionGraph originalJob = ArchivedJobGenerationUtils.getTestJob();
    Collection<ArchivedJson> archives = archivist.archiveJsonWithPath(originalJob);
    Assert.assertEquals(1, archives.size());
    ArchivedJson archive = archives.iterator().next();
    Assert.assertEquals("/jobs/" + originalJob.getJobID() + "/accumulators", archive.getPath());
    compareAccumulators(originalJob, archive.getJson());
}
Also used : JsonArchivist(org.apache.flink.runtime.webmonitor.history.JsonArchivist) ArchivedJson(org.apache.flink.runtime.webmonitor.history.ArchivedJson) AccessExecutionGraph(org.apache.flink.runtime.executiongraph.AccessExecutionGraph) Test(org.junit.Test)

Example 10 with ArchivedJson

use of org.apache.flink.runtime.webmonitor.history.ArchivedJson in project flink by apache.

the class JobConfigHandlerTest method testArchiver.

@Test
public void testArchiver() throws Exception {
    JsonArchivist archivist = new JobConfigHandler.JobConfigJsonArchivist();
    AccessExecutionGraph originalJob = ArchivedJobGenerationUtils.getTestJob();
    Collection<ArchivedJson> archives = archivist.archiveJsonWithPath(originalJob);
    Assert.assertEquals(1, archives.size());
    ArchivedJson archive = archives.iterator().next();
    Assert.assertEquals("/jobs/" + originalJob.getJobID() + "/config", archive.getPath());
    compareJobConfig(originalJob, archive.getJson());
}
Also used : JsonArchivist(org.apache.flink.runtime.webmonitor.history.JsonArchivist) ArchivedJson(org.apache.flink.runtime.webmonitor.history.ArchivedJson) AccessExecutionGraph(org.apache.flink.runtime.executiongraph.AccessExecutionGraph) Test(org.junit.Test)

Aggregations

ArchivedJson (org.apache.flink.runtime.webmonitor.history.ArchivedJson)17 JsonArchivist (org.apache.flink.runtime.webmonitor.history.JsonArchivist)17 Test (org.junit.Test)17 AccessExecutionGraph (org.apache.flink.runtime.executiongraph.AccessExecutionGraph)16 AccessExecutionJobVertex (org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex)7 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 JobID (org.apache.flink.api.common.JobID)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 AccessExecution (org.apache.flink.runtime.executiongraph.AccessExecution)3 CheckpointStatsHistory (org.apache.flink.runtime.checkpoint.CheckpointStatsHistory)2 CheckpointStatsSnapshot (org.apache.flink.runtime.checkpoint.CheckpointStatsSnapshot)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ArrayList (java.util.ArrayList)1 AbstractCheckpointStats (org.apache.flink.runtime.checkpoint.AbstractCheckpointStats)1 CompletedCheckpointStats (org.apache.flink.runtime.checkpoint.CompletedCheckpointStats)1 FailedCheckpointStats (org.apache.flink.runtime.checkpoint.FailedCheckpointStats)1 PendingCheckpointStats (org.apache.flink.runtime.checkpoint.PendingCheckpointStats)1 TaskStateStats (org.apache.flink.runtime.checkpoint.TaskStateStats)1 AccessExecutionVertex (org.apache.flink.runtime.executiongraph.AccessExecutionVertex)1 ExternalizedCheckpointSettings (org.apache.flink.runtime.jobgraph.tasks.ExternalizedCheckpointSettings)1