Search in sources :

Example 11 with AccessExecutionGraph

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

the class CurrentJobsOverviewHandlerTest method testArchiver.

@Test
public void testArchiver() throws Exception {
    JsonArchivist archivist = new CurrentJobsOverviewHandler.CurrentJobsOverviewJsonArchivist();
    AccessExecutionGraph originalJob = ArchivedJobGenerationUtils.getTestJob();
    JobDetails expectedDetails = WebMonitorUtils.createDetailsForJob(originalJob);
    Collection<ArchivedJson> archives = archivist.archiveJsonWithPath(originalJob);
    Assert.assertEquals(1, archives.size());
    ArchivedJson archive = archives.iterator().next();
    Assert.assertEquals("/joboverview", archive.getPath());
    JsonNode result = ArchivedJobGenerationUtils.mapper.readTree(archive.getJson());
    ArrayNode running = (ArrayNode) result.get("running");
    Assert.assertEquals(0, running.size());
    ArrayNode finished = (ArrayNode) result.get("finished");
    Assert.assertEquals(1, finished.size());
    compareJobOverview(expectedDetails, finished.get(0).toString());
}
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) JsonNode(com.fasterxml.jackson.databind.JsonNode) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) JobDetails(org.apache.flink.runtime.messages.webmonitor.JobDetails) Test(org.junit.Test)

Example 12 with AccessExecutionGraph

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

the class CurrentJobsOverviewHandlerTest method testJsonGeneration.

@Test
public void testJsonGeneration() throws Exception {
    AccessExecutionGraph originalJob = ArchivedJobGenerationUtils.getTestJob();
    JobDetails expectedDetails = WebMonitorUtils.createDetailsForJob(originalJob);
    StringWriter writer = new StringWriter();
    try (JsonGenerator gen = ArchivedJobGenerationUtils.jacksonFactory.createGenerator(writer)) {
        CurrentJobsOverviewHandler.writeJobDetailOverviewAsJson(expectedDetails, gen, 0);
    }
    compareJobOverview(expectedDetails, writer.toString());
}
Also used : StringWriter(java.io.StringWriter) JsonGenerator(com.fasterxml.jackson.core.JsonGenerator) AccessExecutionGraph(org.apache.flink.runtime.executiongraph.AccessExecutionGraph) JobDetails(org.apache.flink.runtime.messages.webmonitor.JobDetails) Test(org.junit.Test)

Example 13 with AccessExecutionGraph

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

the class SubtaskExecutionAttemptAccumulatorsHandlerTest method testArchiver.

@Test
public void testArchiver() throws Exception {
    JsonArchivist archivist = new SubtaskExecutionAttemptAccumulatorsHandler.SubtaskExecutionAttemptAccumulatorsJsonArchivist();
    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() + "/subtasks/" + originalAttempt.getParallelSubtaskIndex() + "/attempts/" + originalAttempt.getAttemptNumber() + "/accumulators", archive.getPath());
    compareAttemptAccumulators(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 14 with AccessExecutionGraph

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

the class SubtaskExecutionAttemptDetailsHandlerTest method testJsonGeneration.

@Test
public void testJsonGeneration() throws Exception {
    AccessExecutionGraph originalJob = ArchivedJobGenerationUtils.getTestJob();
    AccessExecutionJobVertex originalTask = ArchivedJobGenerationUtils.getTestTask();
    AccessExecution originalAttempt = ArchivedJobGenerationUtils.getTestAttempt();
    String json = SubtaskExecutionAttemptDetailsHandler.createAttemptDetailsJson(originalAttempt, originalJob.getJobID().toString(), originalTask.getJobVertexId().toString(), null);
    compareAttemptDetails(originalAttempt, json);
}
Also used : AccessExecutionJobVertex(org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex) AccessExecution(org.apache.flink.runtime.executiongraph.AccessExecution) AccessExecutionGraph(org.apache.flink.runtime.executiongraph.AccessExecutionGraph) Test(org.junit.Test)

Example 15 with AccessExecutionGraph

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

the class CheckpointConfigHandlerTest method createGraphAndSettings.

private static GraphAndSettings createGraphAndSettings(boolean externalized, boolean exactlyOnce) {
    long interval = 18231823L;
    long timeout = 996979L;
    long minPause = 119191919L;
    int maxConcurrent = 12929329;
    ExternalizedCheckpointSettings externalizedSetting = externalized ? ExternalizedCheckpointSettings.externalizeCheckpoints(true) : ExternalizedCheckpointSettings.none();
    JobSnapshottingSettings settings = new JobSnapshottingSettings(Collections.<JobVertexID>emptyList(), Collections.<JobVertexID>emptyList(), Collections.<JobVertexID>emptyList(), interval, timeout, minPause, maxConcurrent, externalizedSetting, null, exactlyOnce);
    AccessExecutionGraph graph = mock(AccessExecutionGraph.class);
    when(graph.getJobSnapshottingSettings()).thenReturn(settings);
    return new GraphAndSettings(graph, settings, externalizedSetting);
}
Also used : ExternalizedCheckpointSettings(org.apache.flink.runtime.jobgraph.tasks.ExternalizedCheckpointSettings) JobSnapshottingSettings(org.apache.flink.runtime.jobgraph.tasks.JobSnapshottingSettings) AccessExecutionGraph(org.apache.flink.runtime.executiongraph.AccessExecutionGraph)

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