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