Unverified Commit 2be2d6d4 authored by ZackYoung's avatar ZackYoung Committed by GitHub

[Optimize][pom]optimize pom module code (#1234)

* 模块优化 1. optimize app module * 1. optimize module code 2. add flink version compatible * 1. change 13 to 14 * 1. change 13 to 14 * 1. change udf PythonFunctionFactory code * 1. delete admin module static dir * 1. delete admin module static dir * 1. delete more includes tags * 1. change web clean phase * 1. change web package order * 1. change web package order * change pulsar module
parent 7f501245
......@@ -212,10 +212,28 @@
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}/src/main/resources/static</directory>
</fileset>
</filesets>
</configuration>
<executions>
<execution>
<goals>
<goal>clean</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
......@@ -242,7 +260,7 @@
<goals>
<goal>copy-resources</goal>
</goals>
<phase>validate</phase>
<phase>initialize</phase>
<configuration>
<outputDirectory>src/main/resources/static</outputDirectory>
<overwrite>true</overwrite>
......@@ -259,15 +277,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
<executions>
<execution>
<id>default-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<classesDirectory>target/classes/</classesDirectory>
<excludes>
......@@ -276,6 +285,15 @@
<exclude>/mybatis*.xml</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>default-jar</id>
<goals>
<goal>jar</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
......
......@@ -39,13 +39,10 @@
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-app-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<!-- <scope>provided</scope>-->
<version>8.0.21</version>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
......@@ -81,7 +78,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${target.java.version}</source>
<target>${target.java.version}</target>
......@@ -93,7 +90,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<version>${maven-assembly-plugin.version}</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
......
......@@ -39,13 +39,10 @@
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-app-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<!-- <scope>provided</scope>-->
<version>8.0.21</version>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
......@@ -81,7 +78,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${target.java.version}</source>
<target>${target.java.version}</target>
......@@ -93,7 +90,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<version>${maven-assembly-plugin.version}</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
......
......@@ -39,13 +39,10 @@
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-app-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<!-- <scope>provided</scope>-->
<version>8.0.21</version>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
......@@ -81,7 +78,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${target.java.version}</source>
<target>${target.java.version}</target>
......@@ -93,7 +90,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<version>${maven-assembly-plugin.version}</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
......
......@@ -39,13 +39,10 @@
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-app-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<!-- <scope>provided</scope>-->
<version>8.0.21</version>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
......@@ -81,7 +78,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${target.java.version}</source>
<target>${target.java.version}</target>
......@@ -93,7 +90,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<version>${maven-assembly-plugin.version}</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
......
......@@ -22,13 +22,10 @@
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-app-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<!-- <scope>provided</scope>-->
<version>8.0.21</version>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
......@@ -64,7 +61,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${target.java.version}</source>
<target>${target.java.version}</target>
......@@ -76,7 +73,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<version>${maven-assembly-plugin.version}</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
......
......@@ -37,18 +37,6 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<!-- <scope>provided</scope>-->
<version>8.0.21</version>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-${dlink.flink.version}</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-${dlink.flink.version}</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
......@@ -60,4 +48,101 @@
</dependency>
</dependencies>
<profiles>
<profile>
<id>flink-1.11</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.11</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.11</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>flink-1.12</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.12</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.12</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>flink-1.13</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.13</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.13</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>flink-1.14</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.14</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.14</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>flink-1.15</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.15</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.15</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>flink-1.16</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.16</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.16</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
......@@ -56,5 +56,19 @@
<module>dlink-app-1.15</module>
</modules>
</profile>
<profile>
<id>flink-1.16</id>
<modules>
<module>dlink-app-1.16</module>
</modules>
</profile>
<profile>
<id>web</id>
<modules>
<module>../dlink-web</module>
</modules>
</profile>
</profiles>
</project>
......@@ -54,12 +54,4 @@
</plugins>
</build>
<profiles>
<profile>
<id>web</id>
<modules>
<module>../dlink-web</module>
</modules>
</profile>
</profiles>
</project>
\ No newline at end of file
......@@ -37,10 +37,9 @@
<directory>${project.parent.basedir}/dlink-admin/target/classes</directory>
<outputDirectory>config</outputDirectory>
<includes>
<include>*.properties</include>
<include>*.yml</include>
<include>*.yaml</include>
<include>*.xml</include>
<include>**/*.yml</include>
<include>**/*.yaml</include>
<include>**/log4j2.xml</include>
</includes>
</fileSet>
<fileSet>
......
......@@ -41,7 +41,6 @@
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.13</artifactId>
<!-- <scope>provided</scope>-->
</dependency>
<dependency>
<groupId>junit</groupId>
......
......@@ -39,7 +39,6 @@
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.14</artifactId>
<!-- <scope>provided</scope>-->
</dependency>
<dependency>
<groupId>junit</groupId>
......
......@@ -41,7 +41,6 @@
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.15</artifactId>
<!-- <scope>provided</scope>-->
</dependency>
<dependency>
<groupId>junit</groupId>
......
......@@ -24,7 +24,6 @@
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.16</artifactId>
<!-- <scope>provided</scope>-->
</dependency>
<dependency>
<groupId>junit</groupId>
......
......@@ -28,7 +28,6 @@
<artifactId>dlink-client-1.11</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>${target.java.version}</maven.compiler.source>
<maven.compiler.target>${target.java.version}</maven.compiler.target>
......@@ -38,7 +37,6 @@
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
......
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.flink.client.python;
import static org.apache.flink.client.python.PythonEnvUtils.getGatewayServer;
import static org.apache.flink.client.python.PythonEnvUtils.launchPy4jPythonClient;
import static org.apache.flink.client.python.PythonEnvUtils.setGatewayServer;
import static org.apache.flink.client.python.PythonEnvUtils.startGatewayServer;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.python.shaded.py4j.GatewayServer;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.ReadableConfig;
import org.apache.flink.table.functions.python.PythonFunction;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
/**
* The factory which creates the PythonFunction objects from given module name and object name.
*/
public interface PythonFunctionFactory {
long CHECK_INTERVAL = 100;
long TIMEOUT_MILLIS = 10000;
AtomicReference<PythonFunctionFactory> PYTHON_FUNCTION_FACTORY_REF = new AtomicReference<>();
/**
* Returns PythonFunction according to moduleName and objectName.
*
* @param moduleName The module name of the Python UDF.
* @param objectName The function name / class name of the Python UDF.
* @return The PythonFunction object which represents the Python UDF.
*/
PythonFunction getPythonFunction(String moduleName, String objectName);
/**
* Returns PythonFunction according to the fully qualified name of the Python UDF i.e
* ${moduleName}.${functionName} or ${moduleName}.${className}.
*
* @param fullyQualifiedName The fully qualified name of the Python UDF.
* @param config The configuration of python dependencies.
* @return The PythonFunction object which represents the Python UDF.
*/
static PythonFunction getPythonFunction(String fullyQualifiedName, ReadableConfig config)
throws IOException, ExecutionException, InterruptedException {
int splitIndex = fullyQualifiedName.lastIndexOf(".");
if (splitIndex <= 0) {
throw new IllegalArgumentException(
String.format("The fully qualified name is invalid: '%s'", fullyQualifiedName));
}
String moduleName = fullyQualifiedName.substring(0, splitIndex);
String objectName = fullyQualifiedName.substring(splitIndex + 1);
Configuration mergedConfig =
new Configuration(
ExecutionEnvironment.getExecutionEnvironment().getConfiguration());
mergedConfig.addAll((Configuration) config);
PythonFunctionFactory pythonFunctionFactory = getPythonFunctionFactory(mergedConfig);
return pythonFunctionFactory.getPythonFunction(moduleName, objectName);
}
static PythonFunction getPythonFunction(String fullyQualifiedName, ReadableConfig config, ClassLoader classLoader) throws ExecutionException, IOException, InterruptedException {
return getPythonFunction(fullyQualifiedName, config);
}
static PythonFunctionFactory getPythonFunctionFactory(ReadableConfig config)
throws ExecutionException, InterruptedException, IOException {
synchronized (PythonFunctionFactory.class) {
if (PYTHON_FUNCTION_FACTORY_REF.get() != null) {
return PYTHON_FUNCTION_FACTORY_REF.get();
} else {
Map<String, Object> entryPoint;
if (getGatewayServer() == null) {
GatewayServer gatewayServer = null;
Process pythonProcess = null;
try {
gatewayServer = startGatewayServer();
setGatewayServer(gatewayServer);
List<String> commands = new ArrayList<>();
commands.add("-m");
commands.add("pyflink.pyflink_callback_server");
String tmpDir =
System.getProperty("java.io.tmpdir")
+ File.separator
+ "pyflink"
+ File.separator
+ UUID.randomUUID();
pythonProcess =
launchPy4jPythonClient(
gatewayServer, config, commands, null, tmpDir, false);
entryPoint =
(Map<String, Object>) gatewayServer.getGateway().getEntryPoint();
int i = 0;
while (!entryPoint.containsKey("PythonFunctionFactory")) {
if (!pythonProcess.isAlive()) {
throw new RuntimeException("Python callback server start failed!");
}
try {
Thread.sleep(CHECK_INTERVAL);
} catch (InterruptedException e) {
throw new RuntimeException(
"Interrupted while waiting for the python process to start.",
e);
}
i++;
if (i > TIMEOUT_MILLIS / CHECK_INTERVAL) {
throw new RuntimeException("Python callback server start failed!");
}
}
} catch (Throwable e) {
try {
setGatewayServer(null);
if (gatewayServer != null) {
gatewayServer.shutdown();
}
} catch (Throwable e2) {
// ignore, do not swallow the origin exception.
}
try {
if (pythonProcess != null) {
shutdownPythonProcess(pythonProcess, TIMEOUT_MILLIS);
}
} catch (Throwable e3) {
// ignore, do not swallow the origin exception.
}
throw e;
}
Runtime.getRuntime()
.addShutdownHook(new PythonProcessShutdownHook(pythonProcess));
} else {
entryPoint =
(Map<String, Object>) getGatewayServer().getGateway().getEntryPoint();
}
PythonFunctionFactory pythonFunctionFactory =
(PythonFunctionFactory) entryPoint.get("PythonFunctionFactory");
PYTHON_FUNCTION_FACTORY_REF.set(pythonFunctionFactory);
return pythonFunctionFactory;
}
}
}
static void shutdownPythonProcess(Process pythonProcess, long timeoutMillis) {
pythonProcess.destroy();
try {
pythonProcess.waitFor(timeoutMillis, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException(
"Interrupt while waiting for the python process to stop.", e);
}
if (pythonProcess.isAlive()) {
pythonProcess.destroyForcibly();
}
}
/**
* The shutdown hook used to destroy the Python process.
*/
class PythonProcessShutdownHook extends Thread {
private Process process;
public PythonProcessShutdownHook(Process process) {
this.process = process;
}
@Override
public void run() {
shutdownPythonProcess(process, TIMEOUT_MILLIS);
}
}
}
......@@ -38,7 +38,6 @@
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
......
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.flink.client.python;
import static org.apache.flink.client.python.PythonEnvUtils.getGatewayServer;
import static org.apache.flink.client.python.PythonEnvUtils.launchPy4jPythonClient;
import static org.apache.flink.client.python.PythonEnvUtils.setGatewayServer;
import static org.apache.flink.client.python.PythonEnvUtils.startGatewayServer;
import org.apache.flink.api.java.ExecutionEnvironment;
import org.apache.flink.api.python.shaded.py4j.GatewayServer;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.configuration.ReadableConfig;
import org.apache.flink.python.util.PythonDependencyUtils;
import org.apache.flink.table.functions.python.PythonFunction;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
/**
* The factory which creates the PythonFunction objects from given module name and object name.
*/
public interface PythonFunctionFactory {
long CHECK_INTERVAL = 100;
long TIMEOUT_MILLIS = 10000;
AtomicReference<PythonFunctionFactory> PYTHON_FUNCTION_FACTORY_REF = new AtomicReference<>();
/**
* Returns PythonFunction according to moduleName and objectName.
*
* @param moduleName The module name of the Python UDF.
* @param objectName The function name / class name of the Python UDF.
* @return The PythonFunction object which represents the Python UDF.
*/
PythonFunction getPythonFunction(String moduleName, String objectName);
/**
* Returns PythonFunction according to the fully qualified name of the Python UDF i.e
* ${moduleName}.${functionName} or ${moduleName}.${className}.
*
* @param fullyQualifiedName The fully qualified name of the Python UDF.
* @param config The configuration of python dependencies.
* @return The PythonFunction object which represents the Python UDF.
*/
static PythonFunction getPythonFunction(String fullyQualifiedName, ReadableConfig config)
throws IOException, ExecutionException, InterruptedException {
int splitIndex = fullyQualifiedName.lastIndexOf(".");
if (splitIndex <= 0) {
throw new IllegalArgumentException(
String.format("The fully qualified name is invalid: '%s'", fullyQualifiedName));
}
String moduleName = fullyQualifiedName.substring(0, splitIndex);
String objectName = fullyQualifiedName.substring(splitIndex + 1);
Configuration mergedConfig =
new Configuration(
ExecutionEnvironment.getExecutionEnvironment().getConfiguration());
PythonDependencyUtils.merge(mergedConfig, (Configuration) config);
PythonFunctionFactory pythonFunctionFactory = getPythonFunctionFactory(mergedConfig);
return pythonFunctionFactory.getPythonFunction(moduleName, objectName);
}
static PythonFunction getPythonFunction(String fullyQualifiedName, ReadableConfig config, ClassLoader classLoader) throws ExecutionException, IOException, InterruptedException {
return getPythonFunction(fullyQualifiedName, config);
}
static PythonFunctionFactory getPythonFunctionFactory(ReadableConfig config)
throws ExecutionException, InterruptedException, IOException {
synchronized (PythonFunctionFactory.class) {
if (PYTHON_FUNCTION_FACTORY_REF.get() != null) {
return PYTHON_FUNCTION_FACTORY_REF.get();
} else {
Map<String, Object> entryPoint;
if (getGatewayServer() == null) {
GatewayServer gatewayServer = null;
Process pythonProcess = null;
try {
gatewayServer = startGatewayServer();
setGatewayServer(gatewayServer);
List<String> commands = new ArrayList<>();
commands.add("-m");
commands.add("pyflink.pyflink_callback_server");
String tmpDir =
System.getProperty("java.io.tmpdir")
+ File.separator
+ "pyflink"
+ File.separator
+ UUID.randomUUID();
pythonProcess =
launchPy4jPythonClient(
gatewayServer, config, commands, null, tmpDir, false);
entryPoint =
(Map<String, Object>) gatewayServer.getGateway().getEntryPoint();
int i = 0;
while (!entryPoint.containsKey("PythonFunctionFactory")) {
if (!pythonProcess.isAlive()) {
throw new RuntimeException("Python callback server start failed!");
}
try {
Thread.sleep(CHECK_INTERVAL);
} catch (InterruptedException e) {
throw new RuntimeException(
"Interrupted while waiting for the python process to start.",
e);
}
i++;
if (i > TIMEOUT_MILLIS / CHECK_INTERVAL) {
throw new RuntimeException("Python callback server start failed!");
}
}
} catch (Throwable e) {
try {
setGatewayServer(null);
if (gatewayServer != null) {
gatewayServer.shutdown();
}
} catch (Throwable e2) {
// ignore, do not swallow the origin exception.
}
try {
if (pythonProcess != null) {
shutdownPythonProcess(pythonProcess, TIMEOUT_MILLIS);
}
} catch (Throwable e3) {
// ignore, do not swallow the origin exception.
}
throw e;
}
Runtime.getRuntime()
.addShutdownHook(new PythonProcessShutdownHook(pythonProcess));
} else {
entryPoint =
(Map<String, Object>) getGatewayServer().getGateway().getEntryPoint();
}
PythonFunctionFactory pythonFunctionFactory =
(PythonFunctionFactory) entryPoint.get("PythonFunctionFactory");
PYTHON_FUNCTION_FACTORY_REF.set(pythonFunctionFactory);
return pythonFunctionFactory;
}
}
}
static void shutdownPythonProcess(Process pythonProcess, long timeoutMillis) {
pythonProcess.destroy();
try {
pythonProcess.waitFor(timeoutMillis, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
throw new RuntimeException(
"Interrupt while waiting for the python process to stop.", e);
}
if (pythonProcess.isAlive()) {
pythonProcess.destroyForcibly();
}
}
/**
* The shutdown hook used to destroy the Python process.
*/
class PythonProcessShutdownHook extends Thread {
private Process process;
public PythonProcessShutdownHook(Process process) {
this.process = process;
}
@Override
public void run() {
shutdownPythonProcess(process, TIMEOUT_MILLIS);
}
}
}
......@@ -29,7 +29,6 @@
<artifactId>dlink-client-1.13</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>${target.java.version}</maven.compiler.source>
<maven.compiler.target>${target.java.version}</maven.compiler.target>
......@@ -49,17 +48,6 @@
<artifactId>dlink-flink-1.13</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-connector-jdbc-1.13</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.starrocks</groupId>
<artifactId>flink-connector-starrocks</artifactId>
<version>1.2.3_flink-1.13_${scala.binary.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
......
......@@ -196,6 +196,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
}
}
@Override
public ObjectNode getStreamGraph(String statement) {
List<Operation> operations = super.getParser().parse(statement);
if (operations.size() != 1) {
......@@ -227,10 +228,12 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
}
}
@Override
public JobPlanInfo getJobPlanInfo(List<String> statements) {
return new JobPlanInfo(JsonPlanGenerator.generatePlan(getJobGraphFromInserts(statements)));
}
@Override
public StreamGraph getStreamGraphFromInserts(List<String> statements) {
List<ModifyOperation> modifyOperations = new ArrayList();
for (String statement : statements) {
......@@ -258,10 +261,12 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
}
}
@Override
public JobGraph getJobGraphFromInserts(List<String> statements) {
return getStreamGraphFromInserts(statements).getJobGraph();
}
@Override
public SqlExplainResult explainSqlRecord(String statement, ExplainDetail... extraDetails) {
SqlExplainResult record = new SqlExplainResult();
List<Operation> operations = getParser().parse(statement);
......@@ -290,6 +295,7 @@ public class CustomTableEnvironmentImpl extends TableEnvironmentImpl implements
return record;
}
@Override
public boolean parseAndLoadConfiguration(String statement, StreamExecutionEnvironment environment, Map<String, Object> setMap) {
List<Operation> operations = getParser().parse(statement);
for (Operation operation : operations) {
......
......@@ -50,12 +50,6 @@
<artifactId>jackson-datatype-jsr310</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.starrocks</groupId>
<artifactId>flink-connector-starrocks</artifactId>
<version>1.2.3_flink-1.14_${scala.binary.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
......
......@@ -29,7 +29,6 @@
<artifactId>dlink-client-1.15</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>${target.java.version}</maven.compiler.source>
<maven.compiler.target>${target.java.version}</maven.compiler.target>
......
......@@ -128,15 +128,14 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
<source>${target.java.version}</source>
<target>${target.java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
......
......@@ -38,14 +38,14 @@
<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-api-java-bridge_2.12</artifactId>
<artifactId>flink-table-api-java-bridge_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.doris</groupId>
<artifactId>flink-doris-connector-1.13_2.12</artifactId>
<artifactId>flink-doris-connector-1.13_${scala.binary.version}</artifactId>
<version>1.0.3</version>
</dependency>
</dependencies>
......
......@@ -29,7 +29,6 @@
<artifactId>dlink-connector-jdbc-1.11</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<flink.version>1.11.6</flink.version>
<maven.compiler.source>${target.java.version}</maven.compiler.source>
......@@ -41,26 +40,10 @@
<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.11</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-api-java-bridge_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
<!-- Postgres dependencies -->
<dependency>
<groupId>org.postgresql</groupId>
......@@ -76,38 +59,6 @@
<version>${flink.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-common</artifactId>
<version>${flink.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<!-- A planner dependency won't be necessary once FLIP-32 has been completed. -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner-blink_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner-blink_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
</dependency>
<!-- Postgres test dependencies -->
<dependency>
......
......@@ -29,7 +29,6 @@
<artifactId>dlink-connector-jdbc-1.12</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<flink.version>1.12.7</flink.version>
<maven.compiler.source>${target.java.version}</maven.compiler.source>
......@@ -41,26 +40,10 @@
<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-api-java-bridge_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
<optional>true</optional>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.12</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
<!-- Postgres dependencies -->
<dependency>
<groupId>org.postgresql</groupId>
......@@ -69,45 +52,6 @@
<scope>provided</scope>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-test-utils_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-common</artifactId>
<version>${flink.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<!-- A planner dependency won't be necessary once FLIP-32 has been completed. -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner-blink_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner-blink_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
</dependency>
<!-- Postgres test dependencies -->
<dependency>
......@@ -169,6 +113,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
<configuration>
<!-- 指定打包的jar包输出路径 -->
<outputDirectory>${project.parent.parent.basedir}/build/extends</outputDirectory>
......
......@@ -29,7 +29,6 @@
<artifactId>dlink-connector-jdbc-1.13</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<flink.version>1.13.6</flink.version>
<maven.compiler.source>${target.java.version}</maven.compiler.source>
......@@ -41,24 +40,9 @@
<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-api-java-bridge_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.13</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
<!-- Postgres dependencies -->
......@@ -69,37 +53,6 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-common</artifactId>
<version>${flink.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<!-- A planner dependency won't be necessary once FLIP-32 has been completed. -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner-blink_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner-blink_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
</dependency>
<!-- Postgres test dependencies -->
<dependency>
......
......@@ -38,27 +38,12 @@
</properties>
<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-api-java-bridge_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.14</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
<!-- Postgres dependencies -->
<dependency>
<groupId>org.postgresql</groupId>
......@@ -67,21 +52,6 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-common</artifactId>
<version>${flink.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<!-- A planner dependency won't be necessary once FLIP-32 has been completed. -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
</dependency>
<!-- Postgres test dependencies -->
......
......@@ -29,7 +29,6 @@
<artifactId>dlink-connector-phoenix-1.13</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<flink.version>1.13.6</flink.version>
<maven.compiler.source>${target.java.version}</maven.compiler.source>
......@@ -40,68 +39,12 @@
</properties>
<dependencies>
<!--
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
</dependency>
-->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-api-java-bridge_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<!--<scope>provided</scope>-->
<scope>${phoenix.scope.runtime}</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<!--<scope>provided</scope>-->
<scope>${phoenix.scope.runtime}</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-common</artifactId>
<version>${flink.version}</version>
<type>test-jar</type>
<scope>test</scope>
<!-- <scope>${phoenix.scope.runtime}</scope>-->
</dependency>
<!-- A planner dependency won't be necessary once FLIP-32 has been completed. -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
<!-- <scope>${phoenix.scope.runtime}</scope>-->
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.13</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner-blink_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<type>test-jar</type>
<scope>test</scope>
<!-- <scope>${phoenix.scope.runtime}</scope>-->
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner-blink_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
<!--<scope>${phoenix.scope.runtime}</scope>-->
</dependency>
<dependency>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-core</artifactId>
......@@ -116,6 +59,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
<configuration>
<!-- 指定打包的jar包输出路径 -->
<outputDirectory>${project.parent.parent.basedir}/build/extends</outputDirectory>
......
......@@ -27,7 +27,6 @@
<artifactId>dlink-connector-phoenix-1.14</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<flink.version>1.14.6</flink.version>
<maven.compiler.source>${target.java.version}</maven.compiler.source>
......@@ -39,53 +38,10 @@
<dependencies>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-api-java-bridge_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>${phoenix.scope.runtime}</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<!--<scope>provided</scope>-->
<scope>${phoenix.scope.runtime}</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-common</artifactId>
<version>${flink.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<!-- A planner dependency won't be necessary once FLIP-32 has been completed. -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
</dependency>
<!-- A planner dependency won't be necessary once FLIP-32 has been completed. -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.14</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
<!-- <dependency>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-core</artifactId>
<version>4.14.2-HBase-1.4</version>
<scope>${scope.runtime}</scope>
</dependency>-->
<dependency>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-core</artifactId>
......@@ -105,6 +61,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
<configuration>
<!-- 指定打包的jar包输出路径 -->
<outputDirectory>${project.parent.parent.basedir}/build/extends</outputDirectory>
......
......@@ -27,12 +27,9 @@
<artifactId>dlink-connector-pulsar-1.14</artifactId>
<properties>
<pulsar.version>2.8.2</pulsar.version>
<!--<scala.version>2.11.12</scala.version>-->
<scala.binary.version>2.11</scala.binary.version>
<pulsar.version>2.9.1</pulsar.version>
<hbase.version>1.4.3</hbase.version>
<hadoop.version>2.4.1</hadoop.version>
<!--<flink.shaded.version>9.0</flink.shaded.version>-->
<fastjson.version>1.2.7</fastjson.version>
<flink.version>1.14.6</flink.version>
</properties>
......@@ -67,134 +64,9 @@
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-pulsar_2.11</artifactId>
<artifactId>flink-connector-pulsar_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-json</artifactId>
<version>${flink.version}</version>
</dependency>
<!-- test -->
<!--<dependency>-->
<!--<groupId>org.apache.flink</groupId>-->
<!--<artifactId>flink-streaming-java_2.11</artifactId>-->
<!--<version>${flink.version}</version>-->
<!--&lt;!&ndash;<scope>test</scope>&ndash;&gt;-->
<!--</dependency>-->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-api-java-bridge_2.11</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner_2.11</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-scala_2.11</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-common</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
<!-- core dependencies -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-core</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
<!-- flink-java dependencies -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-java</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
<!-- flink-scala dependencies -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-scala_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
<!-- Table ecosystem -->
<!-- Projects depending on this project won't depend on flink-table-*. -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-api-java-bridge_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
<exclusions>
<!-- Remove unneeded dependency, which is conflicting with our jetty-util version. -->
<exclusion>
<groupId>io.netty</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-clients_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-hadoop-compatibility_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.flink</groupId>
<artifactId>flink-shaded-include-yarn_${scala.binary.version}</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--Test dependencies are only available for Hadoop-2.-->
<!--<dependency>-->
<!--<groupId>org.apache.hbase</groupId>-->
<!--<artifactId>hbase-server</artifactId>-->
<!--<version>${hbase.version}</version>-->
<!--<type>test-jar</type>-->
<!--<scope>test</scope>-->
<!--</dependency>-->
<dependency>
<groupId>org.apache.hadoop</groupId>
......@@ -215,14 +87,6 @@
</exclusions>
</dependency>
<!--<dependency>-->
<!--<groupId>org.apache.hbase</groupId>-->
<!--<artifactId>hbase-hadoop-compat</artifactId>-->
<!--<version>${hbase.version}</version>-->
<!--<scope>test</scope>-->
<!--<type>test-jar</type>-->
<!--</dependency>-->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
......@@ -231,13 +95,6 @@
<scope>test</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>org.apache.hbase</groupId>-->
<!--<artifactId>hbase-hadoop2-compat</artifactId>-->
<!--<version>${hbase.version}</version>-->
<!--<scope>test</scope>-->
<!--<type>test-jar</type>-->
<!--</dependency>-->
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-test-utils_${scala.binary.version}</artifactId>
......@@ -245,11 +102,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-common</artifactId>
<version>${flink.version}</version>
<type>test-jar</type>
<scope>test</scope>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.14</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
......@@ -258,18 +113,6 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>org.apache.pulsar</groupId>-->
<!--<artifactId>pulsar-client</artifactId>-->
<!--<version>${pulsar.version}</version>-->
<!--<exclusions>-->
<!--<exclusion>-->
<!--<groupId>com.google.protobuf</groupId>-->
<!--<artifactId>protobuf-java</artifactId>-->
<!--</exclusion>-->
<!--</exclusions>-->
<!--</dependency>-->
</dependencies>
<build>
......@@ -286,6 +129,7 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
......@@ -324,6 +168,7 @@
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.2</version>
<executions>
......
......@@ -104,7 +104,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>${target.java.version}</source>
<target>${target.java.version}</target>
......@@ -112,6 +111,7 @@
</plugin>
<!--打jar包-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
......
......@@ -43,6 +43,11 @@
<artifactId>flink-python_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-common</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner-blink_${scala.binary.version}</artifactId>
......@@ -67,7 +72,7 @@
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-yarn_2.11</artifactId>
<artifactId>flink-yarn_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<exclusions>
<exclusion>
......@@ -113,8 +118,13 @@
</dependency>
<dependency>
<groupId>org.apache.doris</groupId>
<artifactId>flink-doris-connector-1.11_2.12</artifactId>
<artifactId>flink-doris-connector-1.11_${scala.binary.version}</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -43,6 +43,11 @@
<artifactId>flink-python_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-common</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-planner-blink_${scala.binary.version}</artifactId>
......@@ -67,7 +72,7 @@
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-yarn_2.11</artifactId>
<artifactId>flink-yarn_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<exclusions>
<exclusion>
......@@ -113,9 +118,14 @@
</dependency>
<dependency>
<groupId>org.apache.doris</groupId>
<artifactId>flink-doris-connector-1.12_2.12</artifactId>
<artifactId>flink-doris-connector-1.12_${scala.binary.version}</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -82,7 +82,7 @@
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-yarn_2.11</artifactId>
<artifactId>flink-yarn_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<exclusions>
<exclusion>
......@@ -138,13 +138,18 @@
</dependency>
<dependency>
<groupId>org.apache.doris</groupId>
<artifactId>flink-doris-connector-1.13_2.12</artifactId>
<artifactId>flink-doris-connector-1.13_${scala.binary.version}</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.hudi</groupId>
<artifactId>hudi-flink_2.11</artifactId>
<artifactId>hudi-flink_${scala.binary.version}</artifactId>
<version>0.10.1</version>
</dependency>
<dependency>
<groupId>com.starrocks</groupId>
<artifactId>flink-connector-starrocks</artifactId>
<version>1.2.3_flink-1.13_${scala.binary.version}</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -53,7 +53,6 @@
<groupId>org.apache.flink</groupId>
<artifactId>flink-table-runtime_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
......@@ -163,7 +162,6 @@
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-jdbc_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
......@@ -179,5 +177,15 @@
<artifactId>flink-doris-connector-1.14_${scala.binary.version}</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>com.starrocks</groupId>
<artifactId>flink-connector-starrocks</artifactId>
<version>1.2.3_flink-1.14_${scala.binary.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-json</artifactId>
<version>${flink.version}</version>
</dependency>
</dependencies>
</project>
......@@ -27,16 +27,6 @@
<artifactId>dlink-function</artifactId>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-${dlink.flink.version}</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-${dlink.flink.version}</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
......@@ -65,10 +55,106 @@
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<version>2.12.7</version>
<version>${scala.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>flink-1.11</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.11</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.11</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>flink-1.12</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.12</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.12</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>flink-1.13</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.13</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.13</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>flink-1.14</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.14</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.14</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>flink-1.15</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.15</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.15</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>flink-1.16</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.16</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.16</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
......@@ -71,7 +71,7 @@ public class PythonFunction implements FunctionCompiler, FunctionPackage {
process.info("正在编译 python 代码 , class: " + udf.getClassName());
File pyFile = FileUtil.writeUtf8String(udf.getCode(),
PathConstant.getUdfCompilerPythonPath(missionId, UDFUtil.getPyFileName(udf.getClassName()) + ".py"));
PathConstant.getUdfCompilerPythonPath(missionId, UDFUtil.getPyFileName(udf.getClassName()) + ".py"));
File zipFile = ZipUtil.zip(pyFile);
FileUtil.del(pyFile);
try {
......@@ -79,11 +79,12 @@ public class PythonFunction implements FunctionCompiler, FunctionPackage {
configuration.set(PythonOptions.PYTHON_FILES, zipFile.getAbsolutePath());
configuration.set(PythonOptions.PYTHON_CLIENT_EXECUTABLE, Env.getPath());
configuration.set(PythonOptions.PYTHON_EXECUTABLE, Env.getPath());
PythonFunctionFactory.getPythonFunction(udf.getClassName(), configuration, null);
process.info("Python udf编译成功 ; className:" + udf.getClassName());
} catch (Exception e) {
process.error("Python udf编译失败 ; className:" + udf.getClassName() + " 。 原因: "
+ ExceptionUtil.getRootCauseMessage(e));
+ ExceptionUtil.getRootCauseMessage(e));
return false;
}
FileUtil.del(zipFile);
......@@ -96,8 +97,8 @@ public class PythonFunction implements FunctionCompiler, FunctionPackage {
return new String[0];
}
udfList = udfList.stream()
.filter(udf -> udf.getFunctionLanguage() == FunctionLanguage.PYTHON)
.collect(Collectors.toList());
.filter(udf -> udf.getFunctionLanguage() == FunctionLanguage.PYTHON)
.collect(Collectors.toList());
if (CollUtil.isEmpty(udfList)) {
return new String[0];
......@@ -105,18 +106,18 @@ public class PythonFunction implements FunctionCompiler, FunctionPackage {
InputStream[] inputStreams = udfList.stream().map(udf -> {
File file = FileUtil.writeUtf8String(udf.getCode(), PathConstant.getUdfCompilerPythonPath(missionId,
UDFUtil.getPyFileName(udf.getClassName()) + ".py"));
UDFUtil.getPyFileName(udf.getClassName()) + ".py"));
return FileUtil.getInputStream(file);
}).toArray(InputStream[]::new);
String[] paths =
udfList.stream().map(x -> StrUtil.split(x.getClassName(), ".").get(0) + ".py").toArray(String[]::new);
udfList.stream().map(x -> StrUtil.split(x.getClassName(), ".").get(0) + ".py").toArray(String[]::new);
String path = PathConstant.getUdfPackagePath(missionId, PathConstant.UDF_PYTHON_NAME);
File file = FileUtil.file(path);
FileUtil.del(file);
try (ZipUtils zipWriter = new ZipUtils(file, Charset.defaultCharset())) {
zipWriter.add(paths, inputStreams);
}
return new String[]{path};
return new String[] {path};
}
}
package com.dlink.function.util;
import org.apache.flink.runtime.util.EnvironmentInformation;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
/**
* @author ZackYoung
* @since 0.6.8
*/
public class FlinkUtils {
public static String getFlinkVersion() {
return EnvironmentInformation.getVersion();
}
/**
* @param version flink version。如:1.14.6
* @return flink 大版本,如 14
*/
public static String getFlinkBigVersion(String version) {
return StrUtil.split(version, ".").get(1);
}
/**
*
* @return 获取当前 flink 大版本
*/
public static Integer getCurFlinkBigVersion() {
return Convert.toInt(getFlinkBigVersion(getFlinkVersion()));
}
}
......@@ -56,16 +56,6 @@
<artifactId>junit</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-${dlink.flink.version}</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-${dlink.flink.version}</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-hadoop</artifactId>
......@@ -92,4 +82,102 @@ for k8s commit tasks-->
</dependencies>
<profiles>
<profile>
<id>flink-1.11</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.11</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.11</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>flink-1.12</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.12</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.12</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>flink-1.13</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.13</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.13</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>flink-1.14</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.14</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.14</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>flink-1.15</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.15</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.15</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
</dependencies>
</profile>
<profile>
<id>flink-1.16</id>
<dependencies>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-1.16</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-flink-1.16</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
\ No newline at end of file
......@@ -80,6 +80,7 @@
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
<maven-assembly-plugin.version>3.4.2</maven-assembly-plugin.version>
<maven.resource.version>3.2.0</maven.resource.version>
<maven.clean.version>3.2.0</maven.clean.version>
<junit.version>4.12</junit.version>
<protobuf-java.version>2.5.0</protobuf-java.version>
<jedis.version>2.9.0</jedis.version>
......@@ -505,6 +506,11 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven.clean.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
......@@ -560,7 +566,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
......@@ -677,7 +682,6 @@
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>dev</name>
</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment