Search in sources :

Example 6 with PendingCheckpointStats

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

the class CheckpointStatsSubtaskDetailsHandlerTest method testSubtaskRequestNoSummary.

/**
	 * Tests a subtask details request.
	 */
@Test
public void testSubtaskRequestNoSummary() throws Exception {
    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);
    // no acknowledged
    TaskStateStats task = createTaskStateStats(0);
    when(checkpoint.getTaskStateStats(any(JobVertexID.class))).thenReturn(task);
    JsonNode rootNode = triggerRequest(checkpoint);
    assertNull(rootNode.get("summary"));
}
Also used : PendingCheckpointStats(org.apache.flink.runtime.checkpoint.PendingCheckpointStats) TaskStateStats(org.apache.flink.runtime.checkpoint.TaskStateStats) JobVertexID(org.apache.flink.runtime.jobgraph.JobVertexID) JsonNode(com.fasterxml.jackson.databind.JsonNode) Test(org.junit.Test)

Example 7 with PendingCheckpointStats

use of org.apache.flink.runtime.checkpoint.PendingCheckpointStats 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)

Aggregations

PendingCheckpointStats (org.apache.flink.runtime.checkpoint.PendingCheckpointStats)7 JsonNode (com.fasterxml.jackson.databind.JsonNode)5 Test (org.junit.Test)5 TaskStateStats (org.apache.flink.runtime.checkpoint.TaskStateStats)4 CheckpointStatsHistory (org.apache.flink.runtime.checkpoint.CheckpointStatsHistory)3 CheckpointStatsSnapshot (org.apache.flink.runtime.checkpoint.CheckpointStatsSnapshot)3 AccessExecutionGraph (org.apache.flink.runtime.executiongraph.AccessExecutionGraph)3 JobVertexID (org.apache.flink.runtime.jobgraph.JobVertexID)3 ArrayList (java.util.ArrayList)2 CheckpointStatsCounts (org.apache.flink.runtime.checkpoint.CheckpointStatsCounts)2 CompletedCheckpointStats (org.apache.flink.runtime.checkpoint.CompletedCheckpointStats)2 FailedCheckpointStats (org.apache.flink.runtime.checkpoint.FailedCheckpointStats)2 MinMaxAvgStats (org.apache.flink.runtime.checkpoint.MinMaxAvgStats)2 RestoredCheckpointStats (org.apache.flink.runtime.checkpoint.RestoredCheckpointStats)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 HashMap (java.util.HashMap)1 JobID (org.apache.flink.api.common.JobID)1 AbstractCheckpointStats (org.apache.flink.runtime.checkpoint.AbstractCheckpointStats)1 CompletedCheckpointStatsSummary (org.apache.flink.runtime.checkpoint.CompletedCheckpointStatsSummary)1 ExecutionGraphHolder (org.apache.flink.runtime.webmonitor.ExecutionGraphHolder)1