Skip to content

Commit 0d14dc7

Browse files
committed
modify base flinx version to 1.5.3
1 parent 750dbd0 commit 0d14dc7

File tree

7 files changed

+16
-34
lines changed

7 files changed

+16
-34
lines changed

elasticsearch5/elasticsearch5-sink/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<dependency>
1717
<groupId>org.apache.flink</groupId>
1818
<artifactId>flink-connector-elasticsearch5_2.11</artifactId>
19-
<version>1.4.0</version>
19+
<version>${flink.version}</version>
2020
</dependency>
2121

2222
<dependency>

kafka09/kafka09-source/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
<name>kafka09-source</name>
1515
<url>http://maven.apache.org</url>
1616

17-
<properties>
18-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
19-
<flink.version>1.4.0</flink.version>
20-
</properties>
21-
2217
<dependencies>
2318

2419
<dependency>

kafka10/kafka10-source/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
<name>kafka10-source</name>
1414
<url>http://maven.apache.org</url>
1515

16-
<properties>
17-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18-
<flink.version>1.4.0</flink.version>
19-
</properties>
20-
2116
<dependencies>
2217

2318
<dependency>

kafka11/kafka11-source/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@
1313
<name>kafka11-source</name>
1414
<url>http://maven.apache.org</url>
1515

16-
<properties>
17-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18-
<flink.version>1.4.0</flink.version>
19-
</properties>
20-
2116
<dependencies>
2217

2318
<dependency>

launcher/src/main/java/com/dtstack/flink/sql/launcher/ClusterClientFactory.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,19 @@
1919
package com.dtstack.flink.sql.launcher;
2020

2121
import org.apache.commons.lang.StringUtils;
22+
import org.apache.flink.client.deployment.ClusterRetrieveException;
2223
import org.apache.flink.client.deployment.StandaloneClusterDescriptor;
2324
import org.apache.flink.client.program.ClusterClient;
2425
import org.apache.flink.client.program.StandaloneClusterClient;
26+
import org.apache.flink.client.program.rest.RestClusterClient;
2527
import org.apache.flink.configuration.ConfigConstants;
2628
import org.apache.flink.configuration.Configuration;
2729
import org.apache.flink.configuration.GlobalConfiguration;
2830
import org.apache.flink.core.fs.FileSystem;
2931
import org.apache.flink.yarn.AbstractYarnClusterDescriptor;
3032
import org.apache.flink.yarn.YarnClusterClient;
3133
import org.apache.flink.yarn.YarnClusterDescriptor;
34+
import org.apache.hadoop.yarn.api.records.ApplicationId;
3235
import org.apache.hadoop.yarn.api.records.ApplicationReport;
3336
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
3437
import org.apache.hadoop.yarn.client.api.YarnClient;
@@ -55,7 +58,7 @@
5558
*/
5659
public class ClusterClientFactory {
5760

58-
public static ClusterClient createClusterClient(Properties props) {
61+
public static ClusterClient createClusterClient(Properties props) throws ClusterRetrieveException {
5962
String clientType = props.getProperty(OPTION_MODE);
6063
if(clientType.equals(ClusterMode.MODE_STANDALONE)) {
6164
return createStandaloneClient(props);
@@ -65,20 +68,20 @@ public static ClusterClient createClusterClient(Properties props) {
6568
throw new IllegalArgumentException("Unsupported cluster client type: ");
6669
}
6770

68-
public static StandaloneClusterClient createStandaloneClient(Properties props) {
71+
public static RestClusterClient createStandaloneClient(Properties props) throws ClusterRetrieveException {
6972
String flinkConfDir = props.getProperty(LauncherOptions.OPTION_FLINK_CONF_DIR);
7073
Configuration config = GlobalConfiguration.loadConfiguration(flinkConfDir);
7174
StandaloneClusterDescriptor descriptor = new StandaloneClusterDescriptor(config);
72-
StandaloneClusterClient clusterClient = descriptor.retrieve(null);
75+
RestClusterClient clusterClient = descriptor.retrieve(null);
7376
clusterClient.setDetached(true);
7477
return clusterClient;
7578
}
7679

77-
public static YarnClusterClient createYarnClient(Properties props) {
80+
public static ClusterClient createYarnClient(Properties props) {
7881
String flinkConfDir = props.getProperty(LauncherOptions.OPTION_FLINK_CONF_DIR);
7982
Configuration config = GlobalConfiguration.loadConfiguration(flinkConfDir);
8083
String yarnConfDir = props.getProperty(LauncherOptions.OPTION_YARN_CONF_DIR);
81-
org.apache.hadoop.conf.Configuration yarnConf = new YarnConfiguration();
84+
YarnConfiguration yarnConf = new YarnConfiguration();
8285
if(StringUtils.isNotBlank(yarnConfDir)) {
8386
try {
8487

@@ -96,6 +99,7 @@ public boolean accept(File dir, String name) {
9699
return false;
97100
}
98101
});
102+
99103
if(xmlFileList != null) {
100104
for(File xmlFile : xmlFileList) {
101105
yarnConf.addResource(xmlFile.toURI().toURL());
@@ -105,7 +109,7 @@ public boolean accept(File dir, String name) {
105109
YarnClient yarnClient = YarnClient.createYarnClient();
106110
yarnClient.init(yarnConf);
107111
yarnClient.start();
108-
String applicationId = null;
112+
ApplicationId applicationId = null;
109113

110114
Set<String> set = new HashSet<>();
111115
set.add("Apache Flink");
@@ -129,24 +133,22 @@ public boolean accept(File dir, String name) {
129133
if(thisMemory > maxMemory || thisMemory == maxMemory && thisCores > maxCores) {
130134
maxMemory = thisMemory;
131135
maxCores = thisCores;
132-
applicationId = report.getApplicationId().toString();
136+
applicationId = report.getApplicationId();
133137
}
134138

135139
}
136140

137-
if(org.apache.commons.lang3.StringUtils.isEmpty(applicationId)) {
141+
if(org.apache.commons.lang3.StringUtils.isEmpty(applicationId.toString())) {
138142
throw new RuntimeException("No flink session found on yarn cluster.");
139143
}
140144

141-
yarnClient.stop();
142-
143-
AbstractYarnClusterDescriptor clusterDescriptor = new YarnClusterDescriptor(config, ".");
145+
AbstractYarnClusterDescriptor clusterDescriptor = new YarnClusterDescriptor(config, yarnConf, ".", yarnClient, false);
144146
Field confField = AbstractYarnClusterDescriptor.class.getDeclaredField("conf");
145147
confField.setAccessible(true);
146148
haYarnConf(yarnConf);
147149
confField.set(clusterDescriptor, yarnConf);
148150

149-
YarnClusterClient clusterClient = clusterDescriptor.retrieve(applicationId);
151+
ClusterClient clusterClient = clusterDescriptor.retrieve(applicationId);
150152
clusterClient.setDetached(true);
151153
return clusterClient;
152154
}

mysql/mysql-sink/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
<name>mysql-sink</name>
1515
<url>http://maven.apache.org</url>
1616

17-
<properties>
18-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
19-
<flink.version>1.4.0</flink.version>
20-
</properties>
21-
2217
<dependencies>
2318
<dependency>
2419
<groupId>org.apache.flink</groupId>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<properties>
2424
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
25-
<flink.version>1.4.0</flink.version>
25+
<flink.version>1.5.3</flink.version>
2626
</properties>
2727

2828
<build>

0 commit comments

Comments
 (0)