tillrohrmann commented on a change in pull request #10887: [FLINK-15150][tests] 
Prevent job from reaching terminal state
URL: https://github.com/apache/flink/pull/10887#discussion_r369163346
 
 

 ##########
 File path: 
flink-tests/src/test/java/org/apache/flink/test/runtime/leaderelection/ZooKeeperLeaderElectionITCase.java
 ##########
 @@ -141,13 +144,23 @@ private DispatcherGateway 
getNextLeadingDispatcherGateway(TestingMiniCluster min
                return miniCluster.getDispatcherGatewayFuture().get();
        }
 
-       private JobGraph createJobGraph(int parallelism) {
+       private JobGraph createJobGraph(int parallelism) throws IOException {
                BlockingOperator.isBlocking = true;
                final JobVertex vertex = new JobVertex("blocking operator");
                vertex.setParallelism(parallelism);
                vertex.setInvokableClass(BlockingOperator.class);
 
-               return new JobGraph("Blocking test job", vertex);
+               JobGraph jobGraph = new JobGraph("Blocking test job", vertex);
+
+               // explicitly allow restarts; this is necessary since the 
shutdown may result in the job failing and hence being
+               // removed from ZooKeeper. What happens to running jobs if the 
Dispatcher shuts down in an orderly fashion
+               // is undefined behavior. By allowing restarts we prevent the 
job from reaching a globally terminal state,
+               // causing it to be recovered by the next Dispatcher.
+               ExecutionConfig executionConfig = new ExecutionConfig();
+               
executionConfig.setRestartStrategy(RestartStrategies.fixedDelayRestart(10, 
Duration.ofSeconds(10).toMillis()));
 
 Review comment:
   ```suggestion
                
executionConfig.setRestartStrategy(RestartStrategies.fixedDelayRestart(100, 
Duration.ofMillis(100).toMillis()));
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to