Github user GJL commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5207#discussion_r160997382
  
    --- Diff: 
flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java
 ---
    @@ -148,6 +181,39 @@ private void submitJob(JobGraph jobGraph) throws 
JobSubmissionException {
                }
        }
     
    +   private JobExecutionResult waitForJobExecutionResult(
    +                   final JobID jobId) throws ProgramInvocationException {
    +
    +           final JobMessageParameters messageParameters = new 
JobMessageParameters();
    +           messageParameters.jobPathParameter.resolve(jobId);
    +           JobExecutionResultResponseBody jobExecutionResultResponseBody;
    +           try {
    +                   long attempt = 0;
    +                   do {
    +                           final 
CompletableFuture<JobExecutionResultResponseBody> responseFuture =
    +                                   restClient.sendRequest(
    +                                           
restClusterClientConfiguration.getRestServerAddress(),
    +                                           
restClusterClientConfiguration.getRestServerPort(),
    +                                           
JobExecutionResultHeaders.getInstance(),
    +                                           messageParameters);
    +                           jobExecutionResultResponseBody = 
responseFuture.get(timeout.toMillis(), TimeUnit.MILLISECONDS);
    +                           Thread.sleep(waitStrategy.sleepTime(attempt));
    +                           attempt++;
    +                   }
    +                   while 
(jobExecutionResultResponseBody.getStatus().getStatusId() != 
QueueStatus.StatusId.COMPLETED);
    --- End diff --
    
    Can change it to `getStatus().getId()` to avoid redundancy. However, the 
code will be touched once more in #5223. I can do it there.


---

Reply via email to