You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/01/21 18:33:30 UTC

[GitHub] [flink] zentol commented on a change in pull request #10887: [FLINK-15150][tests] Prevent job from reaching terminal state

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

 ##########
 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:
   My idea here was to not have the job actually restart since it shouldn't be relevant to the test whether the job is running/restarting (just that it's not failed), and these state transitions add additional noise to the logs.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services