use of org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex in project flink by apache.
the class DefaultSchedulerTest method testExceptionHistoryTruncation.
@Test
public void testExceptionHistoryTruncation() {
final JobGraph jobGraph = singleNonParallelJobVertexJobGraph();
configuration.set(WebOptions.MAX_EXCEPTION_HISTORY_SIZE, 1);
final DefaultScheduler scheduler = createSchedulerAndStartScheduling(jobGraph);
final ExecutionAttemptID attemptId0 = Iterables.getOnlyElement(scheduler.requestJob().getArchivedExecutionGraph().getAllExecutionVertices()).getCurrentExecutionAttempt().getAttemptId();
initiateFailure(scheduler, attemptId0, new RuntimeException("old exception"));
taskRestartExecutor.triggerNonPeriodicScheduledTasks();
final ArchivedExecutionVertex executionVertex1 = Iterables.getOnlyElement(scheduler.requestJob().getArchivedExecutionGraph().getAllExecutionVertices());
final RuntimeException exception = new RuntimeException("relevant exception");
final long relevantTimestamp = initiateFailure(scheduler, executionVertex1.getCurrentExecutionAttempt().getAttemptId(), exception);
taskRestartExecutor.triggerNonPeriodicScheduledTasks();
assertThat(scheduler.getExceptionHistory(), IsIterableContainingInOrder.contains(ExceptionHistoryEntryMatcher.matchesFailure(exception, relevantTimestamp, executionVertex1.getTaskNameWithSubtaskIndex(), executionVertex1.getCurrentAssignedResourceLocation())));
}
use of org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex in project flink by apache.
the class DefaultSchedulerTest method allocationIsCanceledWhenVertexIsFailedOrCanceled.
@Test
public void allocationIsCanceledWhenVertexIsFailedOrCanceled() throws Exception {
final JobGraph jobGraph = singleJobVertexJobGraph(2);
testExecutionSlotAllocator.disableAutoCompletePendingRequests();
final DefaultScheduler scheduler = createScheduler(jobGraph, ComponentMainThreadExecutorServiceAdapter.forMainThread(), new PipelinedRegionSchedulingStrategy.Factory(), new RestartAllFailoverStrategy.Factory());
scheduler.startScheduling();
Iterator<ArchivedExecutionVertex> vertexIterator = scheduler.requestJob().getArchivedExecutionGraph().getAllExecutionVertices().iterator();
ArchivedExecutionVertex v1 = vertexIterator.next();
assertThat(testExecutionSlotAllocator.getPendingRequests().keySet(), hasSize(2));
final String exceptionMessage = "expected exception";
scheduler.updateTaskExecutionState(new TaskExecutionState(v1.getCurrentExecutionAttempt().getAttemptId(), ExecutionState.FAILED, new RuntimeException(exceptionMessage)));
vertexIterator = scheduler.requestJob().getArchivedExecutionGraph().getAllExecutionVertices().iterator();
v1 = vertexIterator.next();
ArchivedExecutionVertex v2 = vertexIterator.next();
assertThat(v1.getExecutionState(), is(ExecutionState.FAILED));
assertThat(v2.getExecutionState(), is(ExecutionState.CANCELED));
assertThat(testExecutionSlotAllocator.getPendingRequests().keySet(), hasSize(0));
}
use of org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex in project flink by apache.
the class DefaultSchedulerTest method vertexIsResetBeforeRestarted.
@Test
public void vertexIsResetBeforeRestarted() throws Exception {
final JobGraph jobGraph = singleNonParallelJobVertexJobGraph();
final TestSchedulingStrategy.Factory schedulingStrategyFactory = new TestSchedulingStrategy.Factory();
final DefaultScheduler scheduler = createScheduler(jobGraph, ComponentMainThreadExecutorServiceAdapter.forMainThread(), schedulingStrategyFactory);
final TestSchedulingStrategy schedulingStrategy = schedulingStrategyFactory.getLastCreatedSchedulingStrategy();
final SchedulingTopology topology = schedulingStrategy.getSchedulingTopology();
scheduler.startScheduling();
final SchedulingExecutionVertex onlySchedulingVertex = Iterables.getOnlyElement(topology.getVertices());
schedulingStrategy.schedule(Collections.singletonList(onlySchedulingVertex.getId()));
final ArchivedExecutionVertex onlyExecutionVertex = Iterables.getOnlyElement(scheduler.requestJob().getArchivedExecutionGraph().getAllExecutionVertices());
final ExecutionAttemptID attemptId = onlyExecutionVertex.getCurrentExecutionAttempt().getAttemptId();
scheduler.updateTaskExecutionState(createFailedTaskExecutionState(attemptId));
taskRestartExecutor.triggerScheduledTasks();
assertThat(schedulingStrategy.getReceivedVerticesToRestart(), hasSize(1));
assertThat(onlySchedulingVertex.getState(), is(equalTo(ExecutionState.CREATED)));
}
use of org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex in project flink by apache.
the class DefaultSchedulerTest method skipDeploymentIfVertexVersionOutdated.
@Test
public void skipDeploymentIfVertexVersionOutdated() {
testExecutionSlotAllocator.disableAutoCompletePendingRequests();
final JobGraph jobGraph = nonParallelSourceSinkJobGraph();
final List<JobVertex> sortedJobVertices = jobGraph.getVerticesSortedTopologicallyFromSources();
final ExecutionVertexID sourceExecutionVertexId = new ExecutionVertexID(sortedJobVertices.get(0).getID(), 0);
final ExecutionVertexID sinkExecutionVertexId = new ExecutionVertexID(sortedJobVertices.get(1).getID(), 0);
final DefaultScheduler scheduler = createSchedulerAndStartScheduling(jobGraph);
testExecutionSlotAllocator.completePendingRequest(sourceExecutionVertexId);
final ArchivedExecutionVertex sourceExecutionVertex = scheduler.requestJob().getArchivedExecutionGraph().getAllExecutionVertices().iterator().next();
final ExecutionAttemptID attemptId = sourceExecutionVertex.getCurrentExecutionAttempt().getAttemptId();
scheduler.updateTaskExecutionState(createFailedTaskExecutionState(attemptId));
testRestartBackoffTimeStrategy.setCanRestart(false);
testExecutionSlotAllocator.enableAutoCompletePendingRequests();
taskRestartExecutor.triggerScheduledTasks();
assertThat(testExecutionVertexOperations.getDeployedVertices(), containsInAnyOrder(sourceExecutionVertexId, sinkExecutionVertexId));
assertThat(scheduler.requestJob().getArchivedExecutionGraph().getState(), is(equalTo(JobStatus.RUNNING)));
}
use of org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex in project flink by apache.
the class DefaultSchedulerTest method restartFailedTask.
@Test
public void restartFailedTask() {
final JobGraph jobGraph = singleNonParallelJobVertexJobGraph();
final JobVertex onlyJobVertex = getOnlyJobVertex(jobGraph);
final DefaultScheduler scheduler = createSchedulerAndStartScheduling(jobGraph);
final ArchivedExecutionVertex archivedExecutionVertex = Iterables.getOnlyElement(scheduler.requestJob().getArchivedExecutionGraph().getAllExecutionVertices());
final ExecutionAttemptID attemptId = archivedExecutionVertex.getCurrentExecutionAttempt().getAttemptId();
scheduler.updateTaskExecutionState(createFailedTaskExecutionState(attemptId));
taskRestartExecutor.triggerScheduledTasks();
final List<ExecutionVertexID> deployedExecutionVertices = testExecutionVertexOperations.getDeployedVertices();
final ExecutionVertexID executionVertexId = new ExecutionVertexID(onlyJobVertex.getID(), 0);
assertThat(deployedExecutionVertices, contains(executionVertexId, executionVertexId));
}
Aggregations