TisonKun commented on a change in pull request #10311: [FLINK-14762][client]
Enrich JobClient API
URL: https://github.com/apache/flink/pull/10311#discussion_r351161490
##########
File path: flink-clients/src/main/java/org/apache/flink/client/ClientUtils.java
##########
@@ -125,23 +119,15 @@ public static JobExecutionResult
submitJobAndWaitForResult(
checkNotNull(jobGraph);
checkNotNull(classLoader);
- JobResult jobResult;
-
- try {
- jobResult = client
- .submitJob(jobGraph)
- .thenApply(JobSubmissionResult::getJobID)
- .thenCompose(client::requestJobResult)
- .get();
- } catch (InterruptedException | ExecutionException e) {
- ExceptionUtils.checkInterrupted(e);
- throw new ProgramInvocationException("Could not run
job", jobGraph.getJobID(), e);
- }
-
- try {
- return jobResult.toJobExecutionResult(classLoader);
- } catch (JobExecutionException | IOException |
ClassNotFoundException e) {
- throw new ProgramInvocationException("Job failed",
jobGraph.getJobID(), e);
+ try (JobClient jobClient = client.submitJob(jobGraph).join()){
Review comment:
The same as above. That is
>We don't have the ownership of `ClusterClient` here and if you take a look
at its callers you will find that either the caller close `ClusterClient`
immediately properly or the caller close a shared `ClusterClient` later when it
is end of life.
----------------------------------------------------------------
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