Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/5579#discussion_r170861537 --- Diff: flink-clients/src/main/java/org/apache/flink/client/program/rest/RestClusterClient.java --- @@ -255,14 +258,24 @@ protected JobSubmissionResult submitJob(JobGraph jobGraph, ClassLoader classLoad } } - /** - * Requests the {@link JobResult} for the given {@link JobID}. The method retries multiple - * times to poll the {@link JobResult} before giving up. - * - * @param jobId specifying the job for which to retrieve the {@link JobResult} - * @return Future which is completed with the {@link JobResult} once the job has completed or - * with a failure if the {@link JobResult} could not be retrieved. - */ + @Override + public CompletableFuture<JobStatus> getJobStatus(JobID jobId) { + JobDetailsHeaders detailsHeaders = JobDetailsHeaders.getInstance(); + final JobMessageParameters params = new JobMessageParameters(); + params.jobPathParameter.resolve(jobId); + + CompletableFuture<JobDetailsInfo> responseFuture = sendRequest(detailsHeaders, params); + + return responseFuture.thenApply((JobDetailsInfo jobDetailsInfo) -> { + if (jobDetailsInfo != null) { + return jobDetailsInfo.getJobStatus(); + } + + throw new RuntimeException("Unknown JobStatus."); --- End diff -- Let's not throw unchecked exceptions, especially no runtime exception if the only reason is that the user requested a wrong `JobID`.
---