Search in sources :

Example 6 with CompletedCheckpointStats

use of org.apache.flink.runtime.checkpoint.CompletedCheckpointStats in project flink by apache.

the class CheckpointStatsDetailsHandlerTest method testArchiver.

@Test
public void testArchiver() throws IOException {
    JsonArchivist archivist = new CheckpointStatsDetailsHandler.CheckpointStatsDetailsJsonArchivist();
    CompletedCheckpointStats completedCheckpoint = createCompletedCheckpoint();
    FailedCheckpointStats failedCheckpoint = createFailedCheckpoint();
    List<AbstractCheckpointStats> checkpoints = new ArrayList<>();
    checkpoints.add(failedCheckpoint);
    checkpoints.add(completedCheckpoint);
    CheckpointStatsHistory history = mock(CheckpointStatsHistory.class);
    when(history.getCheckpoints()).thenReturn(checkpoints);
    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());
    ObjectMapper mapper = new ObjectMapper();
    Collection<ArchivedJson> archives = archivist.archiveJsonWithPath(graph);
    Assert.assertEquals(2, archives.size());
    Iterator<ArchivedJson> iterator = archives.iterator();
    ArchivedJson archive1 = iterator.next();
    Assert.assertEquals("/jobs/" + graph.getJobID() + "/checkpoints/details/" + failedCheckpoint.getCheckpointId(), archive1.getPath());
    compareFailedCheckpoint(failedCheckpoint, mapper.readTree(archive1.getJson()));
    ArchivedJson archive2 = iterator.next();
    Assert.assertEquals("/jobs/" + graph.getJobID() + "/checkpoints/details/" + completedCheckpoint.getCheckpointId(), archive2.getPath());
    compareCompletedCheckpoint(completedCheckpoint, mapper.readTree(archive2.getJson()));
}
Also used : AbstractCheckpointStats(org.apache.flink.runtime.checkpoint.AbstractCheckpointStats) ArrayList(java.util.ArrayList) AccessExecutionGraph(org.apache.flink.runtime.executiongraph.AccessExecutionGraph) JsonArchivist(org.apache.flink.runtime.webmonitor.history.JsonArchivist) ArchivedJson(org.apache.flink.runtime.webmonitor.history.ArchivedJson) CheckpointStatsHistory(org.apache.flink.runtime.checkpoint.CheckpointStatsHistory) CompletedCheckpointStats(org.apache.flink.runtime.checkpoint.CompletedCheckpointStats) FailedCheckpointStats(org.apache.flink.runtime.checkpoint.FailedCheckpointStats) CheckpointStatsSnapshot(org.apache.flink.runtime.checkpoint.CheckpointStatsSnapshot) JobID(org.apache.flink.api.common.JobID) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 7 with CompletedCheckpointStats

use of org.apache.flink.runtime.checkpoint.CompletedCheckpointStats in project flink by apache.

the class CheckpointStatsDetailsHandlerTest method testCheckpointDetailsRequestCompletedCheckpoint.

/**
	 * Tests a checkpoint details request for a completed checkpoint.
	 */
@Test
public void testCheckpointDetailsRequestCompletedCheckpoint() throws Exception {
    CompletedCheckpointStats checkpoint = createCompletedCheckpoint();
    JsonNode rootNode = triggerRequest(checkpoint);
    compareCompletedCheckpoint(checkpoint, rootNode);
    verifyTaskNodes(checkpoint.getAllTaskStateStats(), rootNode);
}
Also used : JsonNode(com.fasterxml.jackson.databind.JsonNode) CompletedCheckpointStats(org.apache.flink.runtime.checkpoint.CompletedCheckpointStats) Test(org.junit.Test)

Aggregations

CompletedCheckpointStats (org.apache.flink.runtime.checkpoint.CompletedCheckpointStats)7 FailedCheckpointStats (org.apache.flink.runtime.checkpoint.FailedCheckpointStats)5 ArrayList (java.util.ArrayList)3 AbstractCheckpointStats (org.apache.flink.runtime.checkpoint.AbstractCheckpointStats)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 CheckpointStatsCounts (org.apache.flink.runtime.checkpoint.CheckpointStatsCounts)2 CheckpointStatsHistory (org.apache.flink.runtime.checkpoint.CheckpointStatsHistory)2 CheckpointStatsSnapshot (org.apache.flink.runtime.checkpoint.CheckpointStatsSnapshot)2 MinMaxAvgStats (org.apache.flink.runtime.checkpoint.MinMaxAvgStats)2 PendingCheckpointStats (org.apache.flink.runtime.checkpoint.PendingCheckpointStats)2 RestoredCheckpointStats (org.apache.flink.runtime.checkpoint.RestoredCheckpointStats)2 TaskStateStats (org.apache.flink.runtime.checkpoint.TaskStateStats)2 AccessExecutionGraph (org.apache.flink.runtime.executiongraph.AccessExecutionGraph)2 Test (org.junit.Test)2 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 StringWriter (java.io.StringWriter)1 JobID (org.apache.flink.api.common.JobID)1 CompletedCheckpointStatsSummary (org.apache.flink.runtime.checkpoint.CompletedCheckpointStatsSummary)1 ArchivedJson (org.apache.flink.runtime.webmonitor.history.ArchivedJson)1