Search in sources :

Example 6 with AccessExecutionGraph

use of org.apache.flink.runtime.executiongraph.AccessExecutionGraph in project flink by apache.

the class JobPlanHandlerTest method testArchiver.

@Test
public void testArchiver() throws Exception {
    JsonArchivist archivist = new JobPlanHandler.JobPlanJsonArchivist();
    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() + "/plan", archive.getPath());
    Assert.assertEquals(originalJob.getJsonPlan(), 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 7 with AccessExecutionGraph

use of org.apache.flink.runtime.executiongraph.AccessExecutionGraph in project flink by apache.

the class JobVertexAccumulatorsHandlerTest method testArchiver.

@Test
public void testArchiver() throws Exception {
    JsonArchivist archivist = new JobVertexAccumulatorsHandler.JobVertexAccumulatorsJsonArchivist();
    AccessExecutionGraph originalJob = ArchivedJobGenerationUtils.getTestJob();
    AccessExecutionJobVertex originalTask = ArchivedJobGenerationUtils.getTestTask();
    Collection<ArchivedJson> archives = archivist.archiveJsonWithPath(originalJob);
    Assert.assertEquals(1, archives.size());
    ArchivedJson archive = archives.iterator().next();
    Assert.assertEquals("/jobs/" + originalJob.getJobID() + "/vertices/" + originalTask.getJobVertexId() + "/accumulators", archive.getPath());
    compareAccumulators(originalTask, archive.getJson());
}
Also used : AccessExecutionJobVertex(org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex) 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 8 with AccessExecutionGraph

use of org.apache.flink.runtime.executiongraph.AccessExecutionGraph in project flink by apache.

the class CheckpointStatsSubtaskDetailsHandlerTest method testNoJobVertexIdParam.

/**
	 * Tests request with missing job vertex ID param.
	 */
@Test
public void testNoJobVertexIdParam() throws Exception {
    AccessExecutionGraph graph = mock(AccessExecutionGraph.class);
    CheckpointStatsDetailsSubtasksHandler handler = new CheckpointStatsDetailsSubtasksHandler(mock(ExecutionGraphHolder.class), new CheckpointStatsCache(0));
    Map<String, String> params = new HashMap<>();
    params.put("checkpointid", "1");
    String json = handler.handleRequest(graph, params);
    assertEquals("{}", json);
}
Also used : ExecutionGraphHolder(org.apache.flink.runtime.webmonitor.ExecutionGraphHolder) HashMap(java.util.HashMap) AccessExecutionGraph(org.apache.flink.runtime.executiongraph.AccessExecutionGraph) Test(org.junit.Test)

Example 9 with AccessExecutionGraph

use of org.apache.flink.runtime.executiongraph.AccessExecutionGraph in project flink by apache.

the class CheckpointStatsSubtaskDetailsHandlerTest method testNoCheckpointIdParam.

/**
	 * Tests request with missing checkpoint ID param.
	 */
@Test
public void testNoCheckpointIdParam() throws Exception {
    AccessExecutionGraph graph = mock(AccessExecutionGraph.class);
    CheckpointStatsDetailsSubtasksHandler handler = new CheckpointStatsDetailsSubtasksHandler(mock(ExecutionGraphHolder.class), new CheckpointStatsCache(0));
    String json = handler.handleRequest(graph, Collections.<String, String>emptyMap());
    assertEquals("{}", json);
}
Also used : ExecutionGraphHolder(org.apache.flink.runtime.webmonitor.ExecutionGraphHolder) AccessExecutionGraph(org.apache.flink.runtime.executiongraph.AccessExecutionGraph) Test(org.junit.Test)

Example 10 with AccessExecutionGraph

use of org.apache.flink.runtime.executiongraph.AccessExecutionGraph in project flink by apache.

the class CheckpointStatsSubtaskDetailsHandlerTest method testJobVertexNotFound.

/**
	 * Test lookup of not existing job vertex ID in checkpoint.
	 */
@Test
public void testJobVertexNotFound() throws Exception {
    PendingCheckpointStats inProgress = mock(PendingCheckpointStats.class);
    // not found
    when(inProgress.getTaskStateStats(any(JobVertexID.class))).thenReturn(null);
    CheckpointStatsHistory history = mock(CheckpointStatsHistory.class);
    when(history.getCheckpointById(anyLong())).thenReturn(inProgress);
    CheckpointStatsSnapshot snapshot = mock(CheckpointStatsSnapshot.class);
    when(snapshot.getHistory()).thenReturn(history);
    AccessExecutionGraph graph = mock(AccessExecutionGraph.class);
    when(graph.getCheckpointStatsSnapshot()).thenReturn(snapshot);
    CheckpointStatsDetailsSubtasksHandler handler = new CheckpointStatsDetailsSubtasksHandler(mock(ExecutionGraphHolder.class), new CheckpointStatsCache(0));
    Map<String, String> params = new HashMap<>();
    params.put("checkpointid", "123");
    params.put("vertexid", new JobVertexID().toString());
    String json = handler.handleRequest(graph, params);
    assertEquals("{}", json);
    verify(inProgress, times(1)).getTaskStateStats(any(JobVertexID.class));
}
Also used : PendingCheckpointStats(org.apache.flink.runtime.checkpoint.PendingCheckpointStats) ExecutionGraphHolder(org.apache.flink.runtime.webmonitor.ExecutionGraphHolder) HashMap(java.util.HashMap) JobVertexID(org.apache.flink.runtime.jobgraph.JobVertexID) CheckpointStatsHistory(org.apache.flink.runtime.checkpoint.CheckpointStatsHistory) AccessExecutionGraph(org.apache.flink.runtime.executiongraph.AccessExecutionGraph) CheckpointStatsSnapshot(org.apache.flink.runtime.checkpoint.CheckpointStatsSnapshot) Test(org.junit.Test)

Aggregations

AccessExecutionGraph (org.apache.flink.runtime.executiongraph.AccessExecutionGraph)40 Test (org.junit.Test)33 ArchivedJson (org.apache.flink.runtime.webmonitor.history.ArchivedJson)16 JsonArchivist (org.apache.flink.runtime.webmonitor.history.JsonArchivist)16 ExecutionGraphHolder (org.apache.flink.runtime.webmonitor.ExecutionGraphHolder)14 HashMap (java.util.HashMap)9 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)8 CheckpointStatsHistory (org.apache.flink.runtime.checkpoint.CheckpointStatsHistory)8 CheckpointStatsSnapshot (org.apache.flink.runtime.checkpoint.CheckpointStatsSnapshot)8 AccessExecutionJobVertex (org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex)8 JsonNode (com.fasterxml.jackson.databind.JsonNode)6 JobID (org.apache.flink.api.common.JobID)4 AccessExecution (org.apache.flink.runtime.executiongraph.AccessExecution)4 PendingCheckpointStats (org.apache.flink.runtime.checkpoint.PendingCheckpointStats)3 JobVertexID (org.apache.flink.runtime.jobgraph.JobVertexID)3 ExternalizedCheckpointSettings (org.apache.flink.runtime.jobgraph.tasks.ExternalizedCheckpointSettings)3 JobSnapshottingSettings (org.apache.flink.runtime.jobgraph.tasks.JobSnapshottingSettings)3 ArrayList (java.util.ArrayList)2 AbstractCheckpointStats (org.apache.flink.runtime.checkpoint.AbstractCheckpointStats)2 CompletedCheckpointStats (org.apache.flink.runtime.checkpoint.CompletedCheckpointStats)2