flink 1.12提交用户任务方法问题

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

flink 1.12提交用户任务方法问题

casel.chen
请问 flink 1.11 版本下 用于提交用户任务的方法
org.apache.flink.client.ClientUtils.submitJob(ClusterClient, JobGraph)方法在 flink 1.12版本下找不到了,
现在用哪个方法取代了呢?又该如何获取提交任务后的jobId呢?谢谢!


| publicstaticJobExecutionResultsubmitJob( |
| | ClusterClient<?>client, |
| | JobGraphjobGraph) throwsProgramInvocationException { |
| | checkNotNull(client); |
| | checkNotNull(jobGraph); |
| | try { |
| | return client |
| | .submitJob(jobGraph) |
| | .thenApply(DetachedJobExecutionResult::new) |
| | .get(); |
| | } catch (InterruptedException|ExecutionException e) { |
| | ExceptionUtils.checkInterrupted(e); |
| | thrownewProgramInvocationException("Could not run job in detached mode.", jobGraph.getJobID(), e); |
| | } |
| | } |


https://github.com/apache/flink/blob/release-1.11/flink-clients/src/main/java/org/apache/flink/client/ClientUtils.java#L77
https://github.com/apache/flink/blob/release-1.12/flink-clients/src/main/java/org/apache/flink/client/ClientUtils.java
Reply | Threaded
Open this post in threaded view
|

Re: flink 1.12提交用户任务方法问题

Yang Wang
org.apache.flink.client.ClientUtils#submitJob这个方法不是给用户直接来使用的,所以重构的过程中可能会被移除掉

建议你使用org.apache.flink.client.program.rest.RestClusterClient#submitJob进行代替

Best,
Yang

陈帅 <[hidden email]> 于2020年12月15日周二 下午8:28写道:

> 请问 flink 1.11 版本下 用于提交用户任务的方法
> org.apache.flink.client.ClientUtils.submitJob(ClusterClient, JobGraph)方法在
> flink 1.12版本下找不到了,
> 现在用哪个方法取代了呢?又该如何获取提交任务后的jobId呢?谢谢!
>
>
> | publicstaticJobExecutionResultsubmitJob( |
> | | ClusterClient<?>client, |
> | | JobGraphjobGraph) throwsProgramInvocationException { |
> | | checkNotNull(client); |
> | | checkNotNull(jobGraph); |
> | | try { |
> | | return client |
> | | .submitJob(jobGraph) |
> | | .thenApply(DetachedJobExecutionResult::new) |
> | | .get(); |
> | | } catch (InterruptedException|ExecutionException e) { |
> | | ExceptionUtils.checkInterrupted(e); |
> | | thrownewProgramInvocationException("Could not run job in detached
> mode.", jobGraph.getJobID(), e); |
> | | } |
> | | } |
>
>
>
> https://github.com/apache/flink/blob/release-1.11/flink-clients/src/main/java/org/apache/flink/client/ClientUtils.java#L77
>
> https://github.com/apache/flink/blob/release-1.12/flink-clients/src/main/java/org/apache/flink/client/ClientUtils.java