GJL 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_r333519301
########## 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: What is the difference to `assertEquals(ExecutionState.CREATED, vertex.getState())`? `SchedulingExecutionVertex` always reflects the newest state (it's not a snapshot). Also see my other comment about `ArchivedExecutionVertex`. ---------------------------------------------------------------- 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