zhuzhurk commented on a change in pull request #9860: [FLINK-14331][runtime] 
Reset vertices right after they transition to terminated states
URL: https://github.com/apache/flink/pull/9860#discussion_r333820162
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/DefaultSchedulerTest.java
 ##########
 @@ -254,6 +262,58 @@ public void failJobIfNotEnoughResources() throws 
Exception {
                                "Could not allocate the required slot within 
slot request timeout.").isPresent());
        }
 
+       @Test
+       public void vertexIsResetBeforeRestarted() throws Exception {
+               final JobGraph jobGraph = singleNonParallelJobVertexJobGraph();
+
+               final TestSchedulingStrategy.Factory schedulingStrategyFactory 
= new TestSchedulingStrategy.Factory();
+               final DefaultScheduler scheduler = createScheduler(jobGraph, 
schedulingStrategyFactory);
+               final TestSchedulingStrategy schedulingStrategy = 
schedulingStrategyFactory.getLastCreatedSchedulingStrategy();
+               final SchedulingTopology topology = 
schedulingStrategy.getSchedulingTopology();
+
+               startScheduling(scheduler);
+
+               final SchedulingExecutionVertex vertex = 
Iterables.getOnlyElement(topology.getVertices());
+               final ExecutionAttemptID attemptId = 
scheduler.getExecutionVertex(vertex.getId()).getCurrentExecutionAttempt().getAttemptId();
+
+               
schedulingStrategy.schedule(Collections.singleton(vertex.getId()));
+
+               scheduler.updateTaskExecutionState(new 
TaskExecutionState(jobGraph.getJobID(), attemptId, ExecutionState.FAILED));
+
+               taskRestartExecutor.triggerScheduledTasks();
+
+               Set<ExecutionVertexID> verticesToRestart = 
schedulingStrategy.getReceivedVerticesToRestart();
+               assertEquals(1, verticesToRestart.size());
+               assertEquals(ExecutionState.CREATED, 
topology.getVertexOrThrow(verticesToRestart.iterator().next()).getState());
 
 Review comment:
   done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to