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());
}
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());
}
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);
}
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);
}
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));
}
Aggregations