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

 ##########
 File path: 
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/ProgramDeployer.java
 ##########
 @@ -159,22 +158,15 @@ public JobExecutionResult fetchExecutionResult() {
                        
result.setClusterInformation(clusterClient.getClusterId(), webInterfaceUrl);
                        // submit job (and get result)
                        if (awaitJobResult) {
-                               clusterClient.setDetached(false);
                                final JobExecutionResult jobResult = 
clusterClient
-                                       .submitJob(jobGraph, 
context.getClassLoader())
-                                       .getJobExecutionResult(); // throws 
exception if job fails
+                                       .submitJob(jobGraph)
+                                       
.thenApply(JobSubmissionResult::getJobID)
+                                       
.thenCompose(clusterClient::requestJobResult)
+                                       .get()
+                                       
.toJobExecutionResult(context.getClassLoader()); // throws exception if job 
fails
                                executionResultBucket.add(jobResult);
                        } else {
-                               clusterClient.setDetached(true);
-                               clusterClient.submitJob(jobGraph, 
context.getClassLoader());
-                       }
-               } finally {
-                       try {
-                               if (clusterClient != null) {
-                                       clusterClient.close();
-                               }
-                       } catch (Exception e) {
-                               // ignore
+                               clusterClient.submitJob(jobGraph).get();
 
 Review comment:
   We don't return anything here. What do you mean by "for backwards 
compatibility". Surely I can change it as
   
   ```java
                                   clusterClient
                                        .submitJob(jobGraph)
                                        
.thenApply(JobSubmissionResult::getJobID)
                                        
.thenApply(DetachedJobExecutionResult::new)
                                        .get();
   ```
   
   but I think it is just redundant cycle?

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