kl0u commented on a change in pull request #9972: [FLINK-14496][client] Exclude 
detach flag from ClusterClient
URL: https://github.com/apache/flink/pull/9972#discussion_r341163172
 
 

 ##########
 File path: flink-clients/src/main/java/org/apache/flink/client/ClientUtils.java
 ##########
 @@ -95,15 +100,55 @@ public static ClassLoader 
buildUserCodeClassLoader(List<URL> jars, List<URL> cla
                return FlinkUserCodeClassLoaders.parentFirst(urls, parent);
        }
 
+       public static JobExecutionResult submitJob(
+                       ClusterClient<?> client,
+                       JobGraph jobGraph) throws ProgramInvocationException {
+               try {
+                       return client
+                               .submitJob(jobGraph)
+                               .thenApply(JobSubmissionResult::getJobID)
+                               .thenApply(DetachedJobExecutionResult::new)
+                               .get();
+               } catch (InterruptedException | ExecutionException e) {
+                       ExceptionUtils.checkInterrupted(e);
+                       throw new ProgramInvocationException("Could not run job 
in detached mode.", jobGraph.getJobID(), e);
+               }
+       }
+
+       public static JobExecutionResult submitJobAndWaitForResult(
+                       ClusterClient<?> client,
+                       JobGraph jobGraph,
+                       ClassLoader classLoader) throws 
ProgramInvocationException {
+               JobResult jobResult;
+
 
 Review comment:
   You can add the necessary precondition checks like `checkNotNull()` for the 
`client`, the `jobGraph` and the `classLoader`.

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