Search in sources :

Example 1 with AccessExecution

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

the class AbstractSubtaskAttemptRequestHandler method handleRequest.

@Override
public String handleRequest(AccessExecutionVertex vertex, Map<String, String> params) throws Exception {
    final String attemptNumberString = params.get("attempt");
    if (attemptNumberString == null) {
        throw new RuntimeException("Attempt number parameter missing");
    }
    final int attempt;
    try {
        attempt = Integer.parseInt(attemptNumberString);
    } catch (NumberFormatException e) {
        throw new RuntimeException("Invalid attempt number parameter");
    }
    final AccessExecution currentAttempt = vertex.getCurrentExecutionAttempt();
    if (attempt == currentAttempt.getAttemptNumber()) {
        return handleRequest(currentAttempt, params);
    } else if (attempt >= 0 && attempt < currentAttempt.getAttemptNumber()) {
        AccessExecution exec = vertex.getPriorExecutionAttempt(attempt);
        if (exec != null) {
            return handleRequest(exec, params);
        } else {
            throw new RequestHandlerException("Execution for attempt " + attempt + " has already been deleted.");
        }
    } else {
        throw new RuntimeException("Attempt does not exist: " + attempt);
    }
}
Also used : AccessExecution(org.apache.flink.runtime.executiongraph.AccessExecution)

Example 2 with AccessExecution

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

the class SubtaskExecutionAttemptAccumulatorsHandlerTest method testJsonGeneration.

@Test
public void testJsonGeneration() throws Exception {
    AccessExecution originalAttempt = ArchivedJobGenerationUtils.getTestAttempt();
    String json = SubtaskExecutionAttemptAccumulatorsHandler.createAttemptAccumulatorsJson(originalAttempt);
    compareAttemptAccumulators(originalAttempt, json);
}
Also used : AccessExecution(org.apache.flink.runtime.executiongraph.AccessExecution) Test(org.junit.Test)

Example 3 with AccessExecution

use of org.apache.flink.runtime.executiongraph.AccessExecution 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 4 with AccessExecution

use of org.apache.flink.runtime.executiongraph.AccessExecution 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 5 with AccessExecution

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

the class SubtasksTimesHandlerTest method testJsonGeneration.

@Test
public void testJsonGeneration() throws Exception {
    AccessExecutionJobVertex originalTask = ArchivedJobGenerationUtils.getTestTask();
    AccessExecution originalAttempt = ArchivedJobGenerationUtils.getTestAttempt();
    String json = SubtasksTimesHandler.createSubtaskTimesJson(originalTask);
    compareSubtaskTimes(originalTask, originalAttempt, json);
}
Also used : AccessExecutionJobVertex(org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex) AccessExecution(org.apache.flink.runtime.executiongraph.AccessExecution) Test(org.junit.Test)

Aggregations

AccessExecution (org.apache.flink.runtime.executiongraph.AccessExecution)7 Test (org.junit.Test)6 AccessExecutionJobVertex (org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex)5 AccessExecutionGraph (org.apache.flink.runtime.executiongraph.AccessExecutionGraph)4 ArchivedJson (org.apache.flink.runtime.webmonitor.history.ArchivedJson)3 JsonArchivist (org.apache.flink.runtime.webmonitor.history.JsonArchivist)3