|
6 | 6 | * to you under the Apache License, Version 2.0 (the |
7 | 7 | * "License"); you may not use this file except in compliance |
8 | 8 | * with the License. You may obtain a copy of the License at |
9 | | - * |
| 9 | + * <p> |
10 | 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | | - * |
| 11 | + * <p> |
12 | 12 | * Unless required by applicable law or agreed to in writing, software |
13 | 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
14 | 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
26 | 26 | import org.apache.commons.lang.StringUtils; |
27 | 27 | import org.apache.flink.client.program.ClusterClient; |
28 | 28 | import org.apache.flink.client.program.MiniClusterClient; |
| 29 | +import org.apache.flink.client.program.rest.RestClusterClient; |
| 30 | +import org.apache.flink.client.program.rest.RestClusterClientConfiguration; |
29 | 31 | import org.apache.flink.configuration.Configuration; |
30 | 32 | import org.apache.flink.configuration.GlobalConfiguration; |
31 | 33 | import org.apache.flink.configuration.JobManagerOptions; |
@@ -70,10 +72,7 @@ public static ClusterClient createClusterClient(Options launcherOptions) throws |
70 | 72 | public static ClusterClient createStandaloneClient(Options launcherOptions) throws Exception { |
71 | 73 | String flinkConfDir = launcherOptions.getFlinkconf(); |
72 | 74 | Configuration config = GlobalConfiguration.loadConfiguration(flinkConfDir); |
73 | | - MiniClusterConfiguration.Builder configBuilder = new MiniClusterConfiguration.Builder(); |
74 | | - configBuilder.setConfiguration(config); |
75 | | - MiniCluster miniCluster = new MiniCluster(configBuilder.build()); |
76 | | - MiniClusterClient clusterClient = new MiniClusterClient(config, miniCluster); |
| 75 | + RestClusterClient clusterClient = new RestClusterClient<>(config, "clusterClient"); |
77 | 76 | LeaderConnectionInfo connectionInfo = clusterClient.getClusterConnectionInfo(); |
78 | 77 | InetSocketAddress address = AkkaUtils.getInetSocketAddressFromAkkaURL(connectionInfo.getAddress()); |
79 | 78 | config.setString(JobManagerOptions.ADDRESS, address.getAddress().getHostName()); |
@@ -122,7 +121,7 @@ public static ClusterClient createYarnSessionClient(Options launcherOptions) { |
122 | 121 | } catch (Exception e) { |
123 | 122 | throw new RuntimeException(e); |
124 | 123 | } |
125 | | - }else{ |
| 124 | + } else { |
126 | 125 | throw new RuntimeException("yarn mode must set param of 'yarnconf'!!!"); |
127 | 126 | } |
128 | 127 | } |
|
0 commit comments