zentol commented on a change in pull request #16881:
URL: https://github.com/apache/flink/pull/16881#discussion_r691862484



##########
File path: 
flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java
##########
@@ -371,14 +370,24 @@ public void close() {
                         });
 
         final CompletableFuture<JobSubmitResponseBody> submissionFuture =
-                requestFuture.thenCompose(
-                        requestAndFileUploads ->
-                                sendRetriableRequest(
-                                        JobSubmitHeaders.getInstance(),
-                                        EmptyMessageParameters.getInstance(),
-                                        requestAndFileUploads.f0,
-                                        requestAndFileUploads.f1,
-                                        
isConnectionProblemOrServiceUnavailable()));
+                requestFuture
+                        .thenCompose(
+                                requestAndFileUploads ->
+                                        sendRetriableRequest(
+                                                JobSubmitHeaders.getInstance(),
+                                                
EmptyMessageParameters.getInstance(),
+                                                requestAndFileUploads.f0,
+                                                requestAndFileUploads.f1,
+                                                
isConnectionProblemOrServiceUnavailable()))
+                        .thenApply(
+                                response -> {

Review comment:
       I get why you did it but this seems unnecessarily complicated and not 
intuitive. We are just abusing the response to return information we already 
had at the beginning because the current code structure does not readily 
provide access it.
   
   This also
   a) should be logged _before_ the submission, because the operation may take 
a while or timeout during leader retrieval
   b) should especially be logged if the request fails, which we currently 
don't.
   
   I would suggest to add a `Consumer<URL>` argument to `sendRetriableRequest` 
that is called on each retry with the `WebMonitorBaseUrl`.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to