Skip to content

Commit

Permalink
Merge pull request WeBankFinTech#25 from WeDataSphere/dev-0.2.0-jobst…
Browse files Browse the repository at this point in the history
…ate-interface

[Feature] JobState component in launcher module
  • Loading branch information
wushengyeyouya authored Jun 16, 2022
2 parents 83b8bd3 + fad7c2d commit c6026f8
Show file tree
Hide file tree
Showing 83 changed files with 1,146 additions and 192 deletions.
2 changes: 1 addition & 1 deletion assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>streamis</artifactId>
<groupId>com.webank.wedatasphere.streamis</groupId>
<version>0.1.0</version>
<version>0.2.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
31 changes: 21 additions & 10 deletions db/streamis_ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `linkis_stream_configuration_config_key`;
CREATE TABLE `linkis_stream_configuration_config_key` (
`id` bigint(20) NOT NULL,
`key` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`key` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`description` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`default_value` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
Expand All @@ -31,13 +31,13 @@ CREATE TABLE `linkis_stream_configuration_config_key` (
-- ----------------------------
DROP TABLE IF EXISTS `linkis_stream_configuration_config_value`;
CREATE TABLE `linkis_stream_configuration_config_value` (
`id` bigint(20) NOT NULL,
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`configkey_id` bigint(20) NULL DEFAULT NULL,
`config_value` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`config_value` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`type` int(10) NULL DEFAULT NULL,
`job_id` bigint(20) NULL DEFAULT NULL,
`job_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`config_key` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`job_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`config_key` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `key`(`config_key`) USING BTREE,
INDEX `keyid`(`configkey_id`) USING BTREE
Expand Down Expand Up @@ -129,8 +129,8 @@ DROP TABLE IF EXISTS `linkis_stream_job`;

CREATE TABLE `linkis_stream_job` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`project_name` varchar(50) DEFAULT NULL,
`name` varchar(50) DEFAULT NULL,
`project_name` varchar(100) DEFAULT NULL,
`name` varchar(200) DEFAULT NULL,
`status` tinyint(1) DEFAULT '0' COMMENT '1:已完成 ,2:等待重启 ,3:告警 ,4:慢任务 ,5:运行中 ,6:失败任务',
`create_by` varchar(50) DEFAULT NULL,
`create_time` datetime DEFAULT NULL,
Expand Down Expand Up @@ -182,7 +182,7 @@ DROP TABLE IF EXISTS `linkis_stream_project`;
CREATE TABLE `linkis_stream_project` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`workspace_id` bigint(20) DEFAULT NULL,
`name` varchar(50) DEFAULT NULL,
`name` varchar(100) DEFAULT NULL,
`create_by` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='项目表';
Expand Down Expand Up @@ -211,14 +211,14 @@ DROP TABLE IF EXISTS `linkis_stream_task`;
CREATE TABLE `linkis_stream_task` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`job_version_id` bigint(20) NOT NULL,
`job_id` varchar(50) DEFAULT NULL,
`job_id` varchar(200) DEFAULT NULL,
`version` varchar(50) DEFAULT NULL,
`status` int(3) DEFAULT NULL,
`start_time` datetime DEFAULT NULL,
`last_update_time` datetime DEFAULT NULL,
`err_desc` varchar(10240) DEFAULT NULL,
`submit_user` varchar(50) DEFAULT NULL,
`linkis_job_id` varchar(50) DEFAULT NULL,
`linkis_job_id` varchar(200) DEFAULT NULL,
`linkis_job_info` mediumtext,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='任务表';
Expand All @@ -239,4 +239,15 @@ CREATE TABLE `linkis_stream_alert_record` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

DROP TABLE IF EXISTS `linkis_stream_project_privilege`;

CREATE TABLE `linkis_stream_project_privilege` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`project_id` bigint(20) NOT NULL,
`user_name` varchar(100) NOT NULL,
`privilege` tinyint(1) DEFAULT '0' NOT NULL COMMENT '1:发布权限 ,2:编辑权限 ,3:查看权限 ,4:所有权限 ,5:发布编辑权限 ,6:发布查看权限 ,7:编辑查看权限 ',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='项目权限表';


SET FOREIGN_KEY_CHECKS = 1;
10 changes: 6 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<groupId>com.webank.wedatasphere.streamis</groupId>
<artifactId>streamis</artifactId>
<version>0.1.0</version>
<version>0.2.0</version>
<packaging>pom</packaging>

<name>Streamis Project Parent POM</name>
Expand All @@ -41,11 +41,13 @@
<module>streamis-server</module>
<module>streamis-project</module>
<module>assembly</module>
<module>streamis-appconn</module>
</modules>

<properties>
<linkis.version>1.0.3</linkis.version>
<streamis.version>0.1.0</streamis.version>
<linkis.version>1.1.1</linkis.version>
<dss.version>1.1.0</dss.version>
<streamis.version>0.2.0</streamis.version>
<scala.version>2.11.12</scala.version>
<jdk.compile.version>1.8</jdk.compile.version>
<maven.version>3.3.3</maven.version>
Expand All @@ -67,7 +69,7 @@
<jersey-bean-validation.version>2.21</jersey-bean-validation.version>
<aspectj.version>1.9.5</aspectj.version>
<xstream.version>1.4.19</xstream.version>
<jobmanager.version>0.1.0</jobmanager.version>
<jobmanager.version>0.2.0</jobmanager.version>
<mysql.connector.version>5.1.47</mysql.connector.version>
</properties>

Expand Down
105 changes: 105 additions & 0 deletions streamis-appconn/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>streamis</artifactId>
<groupId>com.webank.wedatasphere.streamis</groupId>
<version>0.2.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>streamis-appconn</artifactId>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>com.webank.wedatasphere.dss</groupId>
<artifactId>dss-appconn-core</artifactId>
<version>${dss.version}</version>
<exclusions>
<exclusion>
<artifactId>linkis-common</artifactId>
<groupId>org.apache.linkis</groupId>
</exclusion>
<exclusion>
<artifactId>json4s-jackson_2.11</artifactId>
<groupId>org.json4s</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis-common</artifactId>
</dependency>
<dependency>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis-module</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<inherited>false</inherited>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/distribution.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
<configuration>
<skipAssembly>false</skipAssembly>
<finalName>out</finalName>
<appendAssemblyId>false</appendAssemblyId>
<attach>false</attach>
<descriptors>
<descriptor>src/main/assembly/distribution.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/application.yml</exclude>
<exclude>**/bootstrap.yml</exclude>
<exclude>**/log4j2.xml</exclude>
</excludes>
</resource>
</resources>
</build>
</project>
62 changes: 62 additions & 0 deletions streamis-appconn/src/main/assembly/distribution.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!--
~ /*
~ * Copyright 2021 WeBank
~ *
~ * Licensed 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.
~ */
-->
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.3 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<!-- Unique key -->
<id>dss-streamis-appconn</id>
<formats>
<format>dir</format>
</formats>
<includeBaseDirectory>true</includeBaseDirectory>
<baseDirectory>streamisAppConn</baseDirectory>

<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<useTransitiveDependencies>true</useTransitiveDependencies>
<unpack>false</unpack>
<useStrictFiltering>true</useStrictFiltering>
<useTransitiveFiltering>true</useTransitiveFiltering>
</dependencySet>
</dependencySets>

<fileSets>
<!-- appconn.properties -->
<fileSet>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>appconn.properties</include>
</includes>
<fileMode>0777</fileMode>
<outputDirectory>conf</outputDirectory>
<lineEnding>unix</lineEnding>
</fileSet>
<!-- init.sql -->
<fileSet>
<directory>${basedir}/src/main/resources</directory>
<includes>
<include>init.sql</include>
</includes>
<fileMode>0777</fileMode>
<outputDirectory>db</outputDirectory>
</fileSet>
</fileSets>
</assembly>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.webank.wedatasphere.streamis.dss.appconn;

import com.webank.wedatasphere.dss.appconn.core.ext.ThirdlyAppConn;
import com.webank.wedatasphere.dss.appconn.core.impl.AbstractOnlySSOAppConn;
import com.webank.wedatasphere.dss.standard.app.development.standard.DevelopmentIntegrationStandard;
import com.webank.wedatasphere.dss.standard.app.structure.StructureIntegrationStandard;
import com.webank.wedatasphere.streamis.dss.appconn.structure.StreamisStructureIntegrationStandard;
import org.apache.linkis.common.conf.CommonVars;

public class StreamisAppConn extends AbstractOnlySSOAppConn implements ThirdlyAppConn {

public static final String STREAMIS_APPCONN_NAME = CommonVars.apply("wds.dss.appconn.streamis.name", "Streamis").getValue();

private StreamisStructureIntegrationStandard structureIntegrationStandard;

@Override
public DevelopmentIntegrationStandard getOrCreateDevelopmentStandard() {
return null;
}

@Override
public StructureIntegrationStandard getOrCreateStructureStandard() {
return structureIntegrationStandard;
}

@Override
protected void initialize() {
structureIntegrationStandard = new StreamisStructureIntegrationStandard();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.webank.wedatasphere.streamis.dss.appconn.structure;

import com.webank.wedatasphere.dss.standard.app.structure.AbstractStructureIntegrationStandard;
import com.webank.wedatasphere.dss.standard.app.structure.project.ProjectService;
import com.webank.wedatasphere.streamis.dss.appconn.structure.project.StreamisProjectService;

/**
* Structure integration standard
*/
public class StreamisStructureIntegrationStandard extends AbstractStructureIntegrationStandard {

/**
* Singleton project service
* @return
*/
@Override
protected ProjectService createProjectService() {
return new StreamisProjectService();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.webank.wedatasphere.streamis.dss.appconn.structure.project;

import com.webank.wedatasphere.dss.common.utils.DSSCommonUtils;
import com.webank.wedatasphere.dss.standard.app.sso.origin.request.action.DSSPostAction;
import com.webank.wedatasphere.dss.standard.app.structure.AbstractStructureOperation;
import com.webank.wedatasphere.dss.standard.app.structure.project.ProjectCreationOperation;
import com.webank.wedatasphere.dss.standard.app.structure.project.ref.DSSProjectContentRequestRef;
import com.webank.wedatasphere.dss.standard.app.structure.project.ref.ProjectResponseRef;
import com.webank.wedatasphere.dss.standard.common.entity.ref.ResponseRef;
import com.webank.wedatasphere.dss.standard.common.exception.operation.ExternalOperationFailedException;
import com.webank.wedatasphere.streamis.dss.appconn.StreamisAppConn;
import com.webank.wedatasphere.streamis.dss.appconn.utils.StreamisCommonUtil;
import org.apache.linkis.server.conf.ServerConfiguration;

import java.util.List;

public class StreamisProjectCreationOperation extends AbstractStructureOperation<DSSProjectContentRequestRef.DSSProjectContentRequestRefImpl, ProjectResponseRef>
implements ProjectCreationOperation<DSSProjectContentRequestRef.DSSProjectContentRequestRefImpl> {

private final static String PROJECT_CREATE_URL = "/api/rest_j/" + ServerConfiguration.BDP_SERVER_VERSION() + "/streamis/createProject";

@Override
protected String getAppConnName() {
return StreamisAppConn.STREAMIS_APPCONN_NAME;
}

@Override
public ProjectResponseRef createProject(DSSProjectContentRequestRef.DSSProjectContentRequestRefImpl dssProjectContentRequestRef) throws ExternalOperationFailedException {
String url = getBaseUrl() + PROJECT_CREATE_URL;
DSSPostAction streamisPostAction = new DSSPostAction();
streamisPostAction.setUser(dssProjectContentRequestRef.getDSSProject().getCreateBy());
streamisPostAction.addRequestPayload("projectName",dssProjectContentRequestRef.getDSSProject().getName());
streamisPostAction.addRequestPayload("description", dssProjectContentRequestRef.getDSSProject().getDescription());
streamisPostAction.addRequestPayload("workspaceName", dssProjectContentRequestRef.getDSSProject().getWorkspaceName());
List<String> accessUsers = dssProjectContentRequestRef.getDSSProjectPrivilege().getAccessUsers();
List<String> editUsers = dssProjectContentRequestRef.getDSSProjectPrivilege().getEditUsers();
List<String> releaseUsers = dssProjectContentRequestRef.getDSSProjectPrivilege().getReleaseUsers();
streamisPostAction.addRequestPayload("accessUsers",accessUsers);
streamisPostAction.addRequestPayload("editUsers",editUsers);
streamisPostAction.addRequestPayload("releaseUsers",releaseUsers);
ResponseRef responseRef = StreamisCommonUtil.getExternalResponseRef(dssProjectContentRequestRef, ssoRequestOperation, url, streamisPostAction);
@SuppressWarnings("unchecked")
Long projectId = DSSCommonUtils.parseToLong(responseRef.getValue("projectId"));
return ProjectResponseRef.newExternalBuilder()
.setRefProjectId(projectId.longValue()).success();
}


}
Loading

0 comments on commit c6026f8

Please sign in to comment.