tillrohrmann commented on a change in pull request #11473: [FLINK-16705] Ensure MiniCluster shutdown does not interfere with JobResult retrieval URL: https://github.com/apache/flink/pull/11473#discussion_r397720022
########## File path: flink-tests/src/test/java/org/apache/flink/test/example/client/LocalExecutorITCase.java ########## @@ -81,4 +114,35 @@ private Plan getWordCountPlan(File inFile, File outFile, int parallelism) { .writeAsCsv(outFile.getAbsolutePath()); return env.createProgramPlan(); } + + private Plan getRuntimeExceptionPlan() { + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + env.fromElements(1) + .map(element -> { + if (element == 1) { + throw new RuntimeException("oups"); + } + return element; + }) + .output(new DiscardingOutputFormat<>()); + return env.createProgramPlan(); + } + + /** + * A normal {@link LocalExecutor} but with the option to retrieve the Minicluster. + */ + private static class InspectableLocalExecutor extends LocalExecutor { + + private MiniCluster miniCluster; + + @Override + protected MiniCluster startMiniCluster(JobGraph jobGraph, Configuration configuration) throws Exception { + return miniCluster = super.startMiniCluster(jobGraph, configuration); + } + + public boolean isMiniClusterRunning() { + Preconditions.checkNotNull(miniCluster, "MiniCluster has not been started yet."); + return miniCluster.isRunning(); + } + } Review comment: I think the proper way of making the `LocalExecutor` inspectable is not to increase the visibility of methods such as `startMiniCluster` but by refactoring the `LocalExecutor` to take a `MiniClusterFactory`. That way you could control the `MiniCluster` instance which is created. ---------------------------------------------------------------- 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