Skip to content

Commit

Permalink
Merge pull request #112 from DataLinkDC/dev
Browse files Browse the repository at this point in the history
0.5.1
  • Loading branch information
aiwenmo authored Jan 24, 2022
2 parents 60d14f2 + 8de4e55 commit 0cd2e3d
Show file tree
Hide file tree
Showing 52 changed files with 545 additions and 348 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Dinky(原 Dlink):

抢先体验( main 主支):dlink-0.6.0-SNAPSHOT

稳定版本( 0.5.0 分支):dlink-0.5.0
稳定版本( 0.5.1 分支):dlink-0.5.1

### 从安装包开始

Expand Down
18 changes: 3 additions & 15 deletions dlink-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>dlink</artifactId>
<groupId>com.dlink</groupId>
<version>0.5.0</version>
<version>0.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -66,7 +66,7 @@
</exclusion>
</exclusions>
</dependency>
<!--<dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
<exclusions>
Expand All @@ -75,18 +75,6 @@
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>-->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
Expand Down Expand Up @@ -136,7 +124,7 @@
<!--<dependency>
<groupId>com.dlink</groupId>
<artifactId>dlink-metadata-mysql</artifactId>
<version>0.5.0-SNAPSHOT</version>
<version>0.5.0</version>
</dependency>-->
<!--<dependency>
<groupId>org.apache.flink</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,32 @@ public TestResult testGateway(ClusterConfiguration clusterConfiguration) {
clusterConfiguration.parseConfig();
Map<String, Object> config = clusterConfiguration.getConfig();
GatewayConfig gatewayConfig = new GatewayConfig();
gatewayConfig.setClusterConfig(ClusterConfig.build(config.get("flinkConfigPath").toString(),
config.get("flinkLibPath").toString(),
config.get("hadoopConfigPath").toString()));
if(config.containsKey("hadoopConfigPath")) {
gatewayConfig.setClusterConfig(ClusterConfig.build(config.get("flinkConfigPath").toString(),
config.get("flinkLibPath").toString(),
config.get("hadoopConfigPath").toString()));
}else {
gatewayConfig.setClusterConfig(ClusterConfig.build(config.get("flinkConfigPath").toString(),
config.get("flinkLibPath").toString(),
""));
}
if(config.containsKey("flinkConfig")){
gatewayConfig.setFlinkConfig(FlinkConfig.build((Map<String, String>)config.get("flinkConfig")));
}
if(Asserts.isEqualsIgnoreCase(clusterConfiguration.getType(),"Yarn")){
gatewayConfig.setType(GatewayType.YARN_PER_JOB);
}else if(Asserts.isEqualsIgnoreCase(clusterConfiguration.getType(),"Kubernetes")){
gatewayConfig.setType(GatewayType.KUBERNETES_APPLICATION);
Map kubernetesConfig = (Map) config.get("kubernetesConfig");
if(kubernetesConfig.containsKey("kubernetes.namespace")) {
gatewayConfig.getFlinkConfig().getConfiguration().put("kubernetes.namespace", kubernetesConfig.get("kubernetes.namespace").toString());
}
if(kubernetesConfig.containsKey("kubernetes.cluster-id")) {
gatewayConfig.getFlinkConfig().getConfiguration().put("kubernetes.cluster-id", kubernetesConfig.get("kubernetes.cluster-id").toString());
}
if(kubernetesConfig.containsKey("kubernetes.container.image")) {
gatewayConfig.getFlinkConfig().getConfiguration().put("kubernetes.container.image", kubernetesConfig.get("kubernetes.container.image").toString());
}
}
return JobManager.testGateway(gatewayConfig);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@
import com.dlink.job.JobManager;
import com.dlink.job.JobResult;
import com.dlink.mapper.TaskMapper;
import com.dlink.metadata.driver.Driver;
import com.dlink.metadata.result.JdbcSelectResult;
import com.dlink.model.*;
import com.dlink.service.*;
import com.dlink.utils.CustomStringJavaCompiler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

Expand All @@ -43,7 +46,7 @@ public class TaskServiceImpl extends SuperServiceImpl<TaskMapper, Task> implemen
@Autowired
private JarService jarService;
@Autowired
private StudioService studioService;
private DataBaseService dataBaseService;

@Value("${spring.datasource.driver-class-name}")
private String driver;
Expand All @@ -63,7 +66,7 @@ public JobResult submitByTaskId(Integer id) {
Task task = this.getTaskInfoById(id);
Asserts.checkNull(task, Tips.TASK_NOT_EXIST);
if(Dialect.isSql(task.getDialect())){
return studioService.executeCommonSql(SqlDTO.build(task.getStatement(),
return executeCommonSql(SqlDTO.build(task.getStatement(),
task.getDatabaseId(),null));
}
JobConfig config = buildJobConfig(task);
Expand All @@ -75,6 +78,38 @@ public JobResult submitByTaskId(Integer id) {
}
}

private JobResult executeCommonSql(SqlDTO sqlDTO) {
JobResult result = new JobResult();
result.setStatement(sqlDTO.getStatement());
result.setStartTime(LocalDateTime.now());
if(Asserts.isNull(sqlDTO.getDatabaseId())){
result.setSuccess(false);
result.setError("请指定数据源");
result.setEndTime(LocalDateTime.now());
return result;
}else{
DataBase dataBase = dataBaseService.getById(sqlDTO.getDatabaseId());
if(Asserts.isNull(dataBase)){
result.setSuccess(false);
result.setError("数据源不存在");
result.setEndTime(LocalDateTime.now());
return result;
}
Driver driver = Driver.build(dataBase.getDriverConfig()).connect();
JdbcSelectResult selectResult = driver.executeSql(sqlDTO.getStatement(),sqlDTO.getMaxRowNum());
driver.close();
result.setResult(selectResult);
if(selectResult.isSuccess()){
result.setSuccess(true);
}else{
result.setSuccess(false);
result.setError(selectResult.getError());
}
result.setEndTime(LocalDateTime.now());
return result;
}
}

private boolean isJarTask(Task task){
return (GatewayType.YARN_APPLICATION.equalsValue(task.getType())||GatewayType.KUBERNETES_APPLICATION.equalsValue(task.getType()))&&Asserts.isNotNull(task.getJarId());
}
Expand Down
2 changes: 1 addition & 1 deletion dlink-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>dlink</artifactId>
<groupId>com.dlink</groupId>
<version>0.5.0</version>
<version>0.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion dlink-assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>dlink</artifactId>
<groupId>com.dlink</groupId>
<version>0.5.0</version>
<version>0.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion dlink-client/dlink-client-1.11/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>dlink-client</artifactId>
<groupId>com.dlink</groupId>
<version>0.5.0</version>
<version>0.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion dlink-client/dlink-client-1.12/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>dlink-client</artifactId>
<groupId>com.dlink</groupId>
<version>0.5.0</version>
<version>0.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion dlink-client/dlink-client-1.13/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>dlink-client</artifactId>
<groupId>com.dlink</groupId>
<version>0.5.0</version>
<version>0.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
68 changes: 8 additions & 60 deletions dlink-client/dlink-client-1.14/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
<parent>
<artifactId>dlink-client</artifactId>
<groupId>com.dlink</groupId>
<version>0.5.0</version>
<version>0.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>dlink-client-1.14</artifactId>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<flink.version>1.14.2</flink.version>
<flink.version>1.14.3</flink.version>
<commons.version>1.3.1</commons.version>
<scala.binary.version>2.11</scala.binary.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Expand Down Expand Up @@ -87,63 +88,10 @@
<groupId>com.dlink</groupId>
<artifactId>dlink-common</artifactId>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>${commons.version}</version>
</dependency>
</dependencies>
<!--<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
&lt;!&ndash;打jar包&ndash;&gt;
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>uber</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>-->
</project>
4 changes: 2 additions & 2 deletions dlink-client/dlink-client-hadoop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<parent>
<artifactId>dlink-client</artifactId>
<groupId>com.dlink</groupId>
<version>0.5.0</version>
<version>0.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>dlink-client-hadoop</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--<scope.type>provided</scope.type>-->
<hadoop.version>2.7.7</hadoop.version>
<hadoop.version>3.1.0</hadoop.version>
<scope.type>compile</scope.type>
</properties>

Expand Down
2 changes: 1 addition & 1 deletion dlink-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>dlink</artifactId>
<groupId>com.dlink</groupId>
<version>0.5.0</version>
<version>0.5.1</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion dlink-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>dlink</artifactId>
<groupId>com.dlink</groupId>
<version>0.5.0</version>
<version>0.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public interface CommonConstant {
/**
* 项目版本号(banner使用)
*/
String PROJECT_VERSION = "0.5.0";
String PROJECT_VERSION = "0.5.1";
/**
* 实例健康
*/
Expand Down
2 changes: 1 addition & 1 deletion dlink-connectors/dlink-connector-jdbc-1.12/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>dlink-connectors</artifactId>
<groupId>com.dlink</groupId>
<version>0.5.0</version>
<version>0.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion dlink-connectors/dlink-connector-jdbc-1.13/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>dlink-connectors</artifactId>
<groupId>com.dlink</groupId>
<version>0.5.0</version>
<version>0.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion dlink-connectors/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>dlink</artifactId>
<groupId>com.dlink</groupId>
<version>0.5.0</version>
<version>0.5.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
Expand Down
Loading

0 comments on commit 0cd2e3d

Please sign in to comment.