rmetzger commented on a change in pull request #13217:
URL: https://github.com/apache/flink/pull/13217#discussion_r475522684
##########
File path: flink-clients/src/main/java/org/apache/flink/client/ClientUtils.java
##########
@@ -111,4 +122,41 @@ public static void executeProgram(
Thread.currentThread().setContextClassLoader(contextClassLoader);
}
}
+
+ /**
+ * This method blocks until the job status is not INITIALIZING anymore.
+ * If the job is FAILED, it throws an CompletionException with the
failure cause.
+ * @param jobStatusSupplier supplier returning the job status.
+ */
+ public static void waitUntilJobInitializationFinished(
+ SupplierWithException<JobStatus, Exception> jobStatusSupplier,
+ SupplierWithException<JobResult, Exception> jobResultSupplier
+ ) throws CompletionException {
Review comment:
For some reason, I assumed that `CompletionExceptions` are the proper
way of signaling an error in futures. However, this assumption seems to be
false, any RuntimeException will be wrapped into a CompletionException by the
future.
I see solutions 2 here
a) declare the method throws any Throwable (then I have to use
`FutureUtils.uncheckedFunction` when I use it within futures, to wrap errors in
RuntimeExceptions
b) wrap any Throwable in a `RuntimeException` and remove the declaration on
the method.
Unless you tell suggest otherwise, I'll go with b) for now.
----------------------------------------------------------------
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]