tillrohrmann commented on a change in pull request #11032: [WIP][FLINK-15918]
URL: https://github.com/apache/flink/pull/11032#discussion_r376348123
 
 

 ##########
 File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/scheduler/DefaultSchedulerTest.java
 ##########
 @@ -596,6 +599,66 @@ public void suspendJobWillIncrementVertexVersions() {
                
assertTrue(executionVertexVersioner.isModified(executionVertexVersion));
        }
 
+       @Test
+       public void jobStatusIsRestartingIfOneVertexIsWaitingForRestart() {
+               final JobGraph jobGraph = singleJobVertexJobGraph(2);
+               final JobID jobId = jobGraph.getJobID();
+               final DefaultScheduler scheduler = 
createSchedulerAndStartScheduling(jobGraph);
+
+               final Iterator<ArchivedExecutionVertex> vertexIterator = 
scheduler.requestJob().getAllExecutionVertices().iterator();
+               final ExecutionAttemptID attemptId1 = 
vertexIterator.next().getCurrentExecutionAttempt().getAttemptId();
+               final ExecutionAttemptID attemptId2 = 
vertexIterator.next().getCurrentExecutionAttempt().getAttemptId();
+
+               scheduler.updateTaskExecutionState(new 
TaskExecutionState(jobId, attemptId1, ExecutionState.FAILED, new 
RuntimeException("expected")));
+               final JobStatus jobStatusAfterFirstFailure = 
scheduler.requestJobStatus();
+               scheduler.updateTaskExecutionState(new 
TaskExecutionState(jobId, attemptId2, ExecutionState.FAILED, new 
RuntimeException("expected")));
+
+               taskRestartExecutor.triggerNonPeriodicScheduledTask();
+               final JobStatus jobStatusWithPendingRestarts = 
scheduler.requestJobStatus();
+               taskRestartExecutor.triggerNonPeriodicScheduledTask();
+               final JobStatus jobStatusAfterRestarts = 
scheduler.requestJobStatus();
+
+               assertThat(jobStatusAfterFirstFailure, 
equalTo(JobStatus.RESTARTING));
+               assertThat(jobStatusWithPendingRestarts, 
equalTo(JobStatus.RESTARTING));
+               assertThat(jobStatusAfterRestarts, equalTo(JobStatus.RUNNING));
+       }
+
+       @Test
+       public void cancelWhileRestartingShouldWaitForRunningTasks() {
+               final JobGraph jobGraph = singleJobVertexJobGraph(2);
+               final JobID jobid = jobGraph.getJobID();
+               final DefaultScheduler scheduler = 
createSchedulerAndStartScheduling(jobGraph);
+
+               final Iterator<ArchivedExecutionVertex> vertexIterator = 
scheduler.requestJob().getAllExecutionVertices().iterator();
+               final ExecutionAttemptID attemptId1 = 
vertexIterator.next().getCurrentExecutionAttempt().getAttemptId();
+               final ExecutionAttemptID attemptId2 = 
vertexIterator.next().getCurrentExecutionAttempt().getAttemptId();
+
+               scheduler.updateTaskExecutionState(new 
TaskExecutionState(jobid, attemptId1, ExecutionState.FAILED, new 
RuntimeException("expected")));
+               scheduler.cancel();
 
 Review comment:
   We should check that this call changes `attemptId2` to go into the 
`CANCELLING` state in order to make sure that the cancel call is being sent.

----------------------------------------------------------------
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