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/08/24 11:05:39 UTC

[GitHub] [flink] rmetzger commented on a change in pull request #13217: [FLINK-16866] Make job submission non-blocking

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