Skip to content

Commit

Permalink
Merge pull request #284 from chaogefeng/master
Browse files Browse the repository at this point in the history
linkis adds shell engine support
  • Loading branch information
chaogefeng authored Feb 10, 2020
2 parents f4f7cec + 7f75f92 commit 66f1c15
Show file tree
Hide file tree
Showing 38 changed files with 1,321 additions and 22 deletions.
35 changes: 29 additions & 6 deletions assembly/src/main/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,26 +130,49 @@
</includes>
</fileSet>

<!-- &lt;!&ndash;pipeline&ndash;&gt;
<!--shell-->
<fileSet>
<directory>
${project.parent.basedir}/ujes/definedEngines/pipeline/entrance/target/
${project.parent.basedir}/ujes/definedEngines/shell/entrance/target/
</directory>
<outputDirectory>share/linkis/ujes/pipeline</outputDirectory>
<outputDirectory>share/linkis/ujes/shell</outputDirectory>
<includes>
<include>*.zip</include>
</includes>
</fileSet>

<fileSet>
<directory>
${project.parent.basedir}/ujes/definedEngines/pipeline/enginemanager/target/
${project.parent.basedir}/ujes/definedEngines/shell/enginemanager/target/
</directory>
<outputDirectory>share/linkis/ujes/pipeline</outputDirectory>
<outputDirectory>share/linkis/ujes/shell</outputDirectory>
<includes>
<include>*.zip</include>
</includes>
</fileSet>-->
</fileSet>



<!-- &lt;!&ndash;pipeline&ndash;&gt;
<fileSet>
<directory>
${project.parent.basedir}/ujes/definedEngines/pipeline/entrance/target/
</directory>
<outputDirectory>share/linkis/ujes/pipeline</outputDirectory>
<includes>
<include>*.zip</include>
</includes>
</fileSet>
<fileSet>
<directory>
${project.parent.basedir}/ujes/definedEngines/pipeline/enginemanager/target/
</directory>
<outputDirectory>share/linkis/ujes/pipeline</outputDirectory>
<includes>
<include>*.zip</include>
</includes>
</fileSet>-->

<!--jdbc-->
<fileSet>
Expand Down
35 changes: 34 additions & 1 deletion bin/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ isSuccess "create $RESULT_SET_ROOT_PATH directory"

##init db
if [[ '2' = "$MYSQL_INSTALL_MODE" ]];then
mysql -h$MYSQL_HOST -P$MYSQL_PORT -u$MYSQL_USER -p$MYSQL_PASSWORD --default-character-set=utf8 -e "CREATE DATABASE IF NOT EXISTS $MYSQL_DB DEFAULT CHARSET utf8 COLLATE utf8_general_ci;"
mysql -h$MYSQL_HOST -P$MYSQL_PORT -u$MYSQL_USER -p$MYSQL_PASSWORD -D$MYSQL_DB --default-character-set=utf8 -e "source ${workDir}/db/linkis_ddl.sql"
isSuccess "source linkis_ddl.sql"
mysql -h$MYSQL_HOST -P$MYSQL_PORT -u$MYSQL_USER -p$MYSQL_PASSWORD -D$MYSQL_DB --default-character-set=utf8 -e "source ${workDir}/db/linkis_dml.sql"
Expand Down Expand Up @@ -610,6 +611,38 @@ executeCMD $SERVER_IP "sed -i ${txt} \"s#wds.linkis.resultSet.store.path.*#wd
executeCMD $SERVER_IP "sed -i ${txt} \"s#\#hadoop.config.dir.*#hadoop.config.dir=$HADOOP_CONF_DIR#g\" $SERVER_CONF_PATH"
isSuccess "subsitution linkis.properties of $SERVER_NAME"
echo "<----------------$SERVER_NAME:end------------------->"
##SparkEntrance install end
##JDBCEntrance install end


##ShellEM install
PACKAGE_DIR=linkis/ujes/shell
SERVER_NAME=linkis-ujes-shell-enginemanager
SERVER_IP=$SHELL_INSTALL_IP
SERVER_PORT=$SHELL_EM_PORT
SERVER_HOME=$LINKIS_INSTALL_HOME
###install dir
installPackage
###update linkis.properties
echo "$SERVER_NAME-step4:update linkis conf"
SERVER_CONF_PATH=$SERVER_HOME/$SERVER_NAME/conf/linkis.properties
executeCMD $SERVER_IP "sed -i ${txt} \"s#wds.linkis.enginemanager.sudo.script.*#wds.linkis.enginemanager.sudo.script=$SERVER_HOME/$SERVER_NAME/bin/rootScript.sh#g\" $SERVER_CONF_PATH"
SERVER_ENGINE_CONF_PATH=$SERVER_HOME/$SERVER_NAME/conf/linkis-engine.properties
executeCMD $SERVER_IP "sed -i ${txt} \"s#\#hadoop.config.dir.*#hadoop.config.dir=$HADOOP_CONF_DIR#g\" $SERVER_ENGINE_CONF_PATH"
isSuccess "subsitution linkis.properties of $SERVER_NAME"
echo "<----------------$SERVER_NAME:end------------------->"

##SHELLEntrance install
PACKAGE_DIR=linkis/ujes/shell
SERVER_NAME=linkis-ujes-shell-entrance
SERVER_PORT=$SHELL_ENTRANCE_PORT
###install dir
installPackage
###update linkis.properties
echo "$SERVER_NAME-step4:update linkis conf"
SERVER_CONF_PATH=$SERVER_HOME/$SERVER_NAME/conf/linkis.properties
executeCMD $SERVER_IP "sed -i ${txt} \"s#\#hadoop.config.dir.*#hadoop.config.dir=$HADOOP_CONF_DIR#g\" $SERVER_CONF_PATH"
isSuccess "subsitution linkis.properties of $SERVER_NAME"
echo "<----------------$SERVER_NAME:end------------------->"
##SHELLEntrance install end


10 changes: 10 additions & 0 deletions bin/start-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ SERVER_NAME="python-enginemanager"
SERVER_IP=$PYTHON_INSTALL_IP
startApp

#shell-entrance
SERVER_NAME="shell-entrance"
SERVER_IP=$SHELL_INSTALL_IP
startApp

#shell-enginemanager
SERVER_NAME="shell-enginemanager"
SERVER_IP=$SHELL_INSTALL_IP
startApp

#spark-entrance
SERVER_NAME="spark-entrance"
SERVER_IP=$SPARK_INSTALL_IP
Expand Down
10 changes: 10 additions & 0 deletions bin/stop-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,16 @@ SERVER_NAME="python-enginemanager"
SERVER_IP=$PYTHON_INSTALL_IP
stopApp

#shell-entrance
SERVER_NAME="shell-entrance"
SERVER_IP=$SHELL_INSTALL_IP
stopApp

#shell-enginemanager
SERVER_NAME="shell-enginemanager"
SERVER_IP=$SHELL_INSTALL_IP
stopApp

#spark-entrance
SERVER_NAME="spark-entrance"
SERVER_IP=$SPARK_INSTALL_IP
Expand Down
7 changes: 7 additions & 0 deletions conf/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ PYTHON_ENTRANCE_PORT=9110
#JDBC_INSTALL_IP=127.0.0.1
JDBC_ENTRANCE_PORT=9111

### SHELL
### This service is used to provide shell capability.
#SHELL_INSTALL_IP=127.0.0.1
SHELL_EM_PORT=9114
SHELL_ENTRANCE_PORT=9115



### BML
### This service is used to provide BML capability.
Expand Down
2 changes: 1 addition & 1 deletion db/module/linkis_query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CREATE TABLE `linkis_task` (
`instance` varchar(50) DEFAULT NULL COMMENT 'An instance of Entrance, consists of IP address of the entrance server and port',
`exec_id` varchar(50) DEFAULT NULL COMMENT 'execution ID, consists of jobID(generated by scheduler), executeApplicationName , creator and instance',
`um_user` varchar(50) DEFAULT NULL COMMENT 'User name',
`execution_code` text COMMNT 'Run script. When exceeding 6000 lines, script would be stored in HDFS and its file path would be stored in database',
`execution_code` text COMMENT 'Run script. When exceeding 6000 lines, script would be stored in HDFS and its file path would be stored in database',
`progress` float DEFAULT NULL COMMENT 'Script execution progress, between zero and one',
`log_path` varchar(200) DEFAULT NULL COMMENT 'File path of the log files',
`result_location` varchar(200) DEFAULT NULL COMMENT 'File path of the result',
Expand Down
18 changes: 4 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@
<module>ujes/definedEngines/python/engine</module>
<module>ujes/definedEngines/python/enginemanager</module>
<module>ujes/definedEngines/python/entrance</module>
<module>ujes/definedEngines/shell/engine</module>
<module>ujes/definedEngines/shell/enginemanager</module>
<module>ujes/definedEngines/shell/entrance</module>
<module>ujes/definedEngines/jdbc/entrance</module>
<module>ujes/client</module>
<module>ujes/definedEngines/pipeline/engine</module>
Expand Down Expand Up @@ -297,20 +300,7 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>
</profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public static String getOpenFileTypeByFileName(String path) throws WorkSpaceExce
|| path.endsWith(".py")
|| path.endsWith(".mlsql")
|| path.endsWith(".jdbc")
|| path.endsWith(".shell")
) {
return "script";
} else if (path.endsWith(".dolphin")) {
Expand Down
113 changes: 113 additions & 0 deletions ujes/definedEngines/shell/engine/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2019 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.
-->

<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>linkis</artifactId>
<groupId>com.webank.wedatasphere.linkis</groupId>
<version>0.9.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>linkis-shell-engine</artifactId>
<version>${linkis.version}</version>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-exec</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>com.webank.wedatasphere.linkis</groupId>
<artifactId>linkis-ujes-engine</artifactId>
<version>${linkis.version}</version>
</dependency>
<dependency>
<groupId>com.webank.wedatasphere.linkis</groupId>
<artifactId>linkis-common</artifactId>
<version>${linkis.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId>
<version>${spring.eureka.version}</version>
</dependency>
<dependency>
<groupId>com.webank.wedatasphere.linkis</groupId>
<artifactId>linkis-cloudRPC</artifactId>
<version>${linkis.version}</version>
</dependency>
<dependency>
<groupId>com.webank.wedatasphere.linkis</groupId>
<artifactId>linkis-storage</artifactId>
<version>${linkis.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.webank.wedatasphere.linkis</groupId>
<artifactId>linkis-bml-hook</artifactId>
<version>${linkis.version}</version>
</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>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
<finalName>${project.artifactId}-${project.version}</finalName>
</build>


</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.webank.wedatasphere.linkis.engine.shell.codeparser

import com.webank.wedatasphere.linkis.engine.execute.CodeType.CodeType
import com.webank.wedatasphere.linkis.engine.execute.{CodeType, EngineExecutorContext, SingleCodeParser}

/**
* created by cooperyang on 2019/5/16
* Description: shell的代码解析器,shell代码不能进行切分,因为shell代码需要进入到
*/
class ShellCodeParser extends SingleCodeParser{
override val codeType: CodeType = CodeType.Shell

override def parse(code: String, engineExecutorContext: EngineExecutorContext): Array[String] = {
Array(code)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.webank.wedatasphere.linkis.engine.shell.conf

import com.webank.wedatasphere.linkis.common.conf.CommonVars

/**
* created by cooperyang on 2019/5/14
* Description:
*/
object ShellEngineConfiguration {
val OUTPUT_LIMIT = CommonVars("bdp.dataworkcloud.shell.output.limit", 5000)
val WORKING_DIR = CommonVars("bdp.dataworkcloud.shell.working.dir", "/appcom/")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.webank.wedatasphere.linkis.engine.shell.conf

import com.webank.wedatasphere.linkis.engine.execute.hook._
import com.webank.wedatasphere.linkis.engine.execute.{CodeParser, EngineHook}
import com.webank.wedatasphere.linkis.engine.shell.codeparser.ShellCodeParser
import org.springframework.context.annotation.{Bean, Configuration}

/**
* created by cooperyang on 2019/5/17
* Description:
*/
@Configuration
class ShellEngineSpringConf {
@Bean(Array("codeParser"))
def createCodeParser(): CodeParser = new ShellCodeParser()


@Bean(Array("engineHooks"))
def createEngineHooks(): Array[EngineHook] =
Array(new ReleaseEngineHook, new MaxExecuteNumEngineHook)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.webank.wedatasphere.linkis.engine.shell.exception

import com.webank.wedatasphere.linkis.common.exception.ErrorException

/**
* created by cooperyang on 2019/5/17
* Description:
*/
case class NoCorrectUserException() extends ErrorException(50036, "No illegal user holds this process")


case class ShellCodeErrorException() extends ErrorException(50037, "shell code is wrong")
Loading

0 comments on commit 66f1c15

Please sign in to comment.