Search in sources :

Example 6 with ArchivedExecutionVertex

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())));
}
Also used : JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) ExecutionAttemptID(org.apache.flink.runtime.executiongraph.ExecutionAttemptID) ArchivedExecutionVertex(org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex) AdaptiveSchedulerTest(org.apache.flink.runtime.scheduler.adaptive.AdaptiveSchedulerTest) Test(org.junit.Test)

Example 7 with ArchivedExecutionVertex

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));
}
Also used : JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) RestartAllFailoverStrategy(org.apache.flink.runtime.executiongraph.failover.flip1.RestartAllFailoverStrategy) ArchivedExecutionVertex(org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex) Matchers.containsString(org.hamcrest.Matchers.containsString) PipelinedRegionSchedulingStrategy(org.apache.flink.runtime.scheduler.strategy.PipelinedRegionSchedulingStrategy) TaskExecutionState(org.apache.flink.runtime.taskmanager.TaskExecutionState) AdaptiveSchedulerTest(org.apache.flink.runtime.scheduler.adaptive.AdaptiveSchedulerTest) Test(org.junit.Test)

Example 8 with ArchivedExecutionVertex

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)));
}
Also used : JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) SchedulingExecutionVertex(org.apache.flink.runtime.scheduler.strategy.SchedulingExecutionVertex) ExecutionAttemptID(org.apache.flink.runtime.executiongraph.ExecutionAttemptID) ArchivedExecutionVertex(org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex) TestingCheckpointRecoveryFactory(org.apache.flink.runtime.checkpoint.TestingCheckpointRecoveryFactory) SchedulingStrategyFactory(org.apache.flink.runtime.scheduler.strategy.SchedulingStrategyFactory) TestFailoverStrategyFactory(org.apache.flink.runtime.executiongraph.utils.TestFailoverStrategyFactory) CheckpointRecoveryFactory(org.apache.flink.runtime.checkpoint.CheckpointRecoveryFactory) SchedulingTopology(org.apache.flink.runtime.scheduler.strategy.SchedulingTopology) TestSchedulingStrategy(org.apache.flink.runtime.scheduler.strategy.TestSchedulingStrategy) AdaptiveSchedulerTest(org.apache.flink.runtime.scheduler.adaptive.AdaptiveSchedulerTest) Test(org.junit.Test)

Example 9 with ArchivedExecutionVertex

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)));
}
Also used : JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) JobVertex(org.apache.flink.runtime.jobgraph.JobVertex) ExecutionAttemptID(org.apache.flink.runtime.executiongraph.ExecutionAttemptID) ExecutionVertexID(org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID) ArchivedExecutionVertex(org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex) AdaptiveSchedulerTest(org.apache.flink.runtime.scheduler.adaptive.AdaptiveSchedulerTest) Test(org.junit.Test)

Example 10 with ArchivedExecutionVertex

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));
}
Also used : JobGraph(org.apache.flink.runtime.jobgraph.JobGraph) JobVertex(org.apache.flink.runtime.jobgraph.JobVertex) ExecutionAttemptID(org.apache.flink.runtime.executiongraph.ExecutionAttemptID) ExecutionVertexID(org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID) ArchivedExecutionVertex(org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex) AdaptiveSchedulerTest(org.apache.flink.runtime.scheduler.adaptive.AdaptiveSchedulerTest) Test(org.junit.Test)

Aggregations

ArchivedExecutionVertex (org.apache.flink.runtime.executiongraph.ArchivedExecutionVertex)24 Test (org.junit.Test)21 ExecutionAttemptID (org.apache.flink.runtime.executiongraph.ExecutionAttemptID)19 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)19 AdaptiveSchedulerTest (org.apache.flink.runtime.scheduler.adaptive.AdaptiveSchedulerTest)18 JobVertex (org.apache.flink.runtime.jobgraph.JobVertex)7 ExecutionVertexID (org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID)7 TaskExecutionState (org.apache.flink.runtime.taskmanager.TaskExecutionState)7 ExecutionState (org.apache.flink.runtime.execution.ExecutionState)5 JobStatus (org.apache.flink.api.common.JobStatus)4 ArchivedExecution (org.apache.flink.runtime.executiongraph.ArchivedExecution)4 LocalTaskManagerLocation (org.apache.flink.runtime.taskmanager.LocalTaskManagerLocation)4 JobID (org.apache.flink.api.common.JobID)3 Configuration (org.apache.flink.configuration.Configuration)3 TestingCheckpointRecoveryFactory (org.apache.flink.runtime.checkpoint.TestingCheckpointRecoveryFactory)3 AllocationID (org.apache.flink.runtime.clusterframework.types.AllocationID)3 ArchivedExecutionJobVertex (org.apache.flink.runtime.executiongraph.ArchivedExecutionJobVertex)3 ErrorInfo (org.apache.flink.runtime.executiongraph.ErrorInfo)3 RootExceptionHistoryEntry (org.apache.flink.runtime.scheduler.exceptionhistory.RootExceptionHistoryEntry)3 ArrayList (java.util.ArrayList)2