Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug about PR #950, Related issues: #946. #1028

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ wds.linkis.engineconn.root.dir=/appcom/tmp
##Spring
spring.server.port=9102

##set engine environment in econn start script, such as EUREKA_PREFER_IP,the value of env will read from ecm host by key.
#wds.linkis.engineconn.env.keys=EUREKA_PREFER_IP,

Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,11 @@ object GovernanceCommonConf {
val ENGINE_DEFAULT_LIMIT = CommonVars("wds.linkis.engine.default.limit", 5000)

val RESULT_SET_STORE_PATH = CommonVars("wds.linkis.resultSet.store.path", CommonVars[String]("wds.linkis.filesystem.hdfs.root.path", "hdfs:///tmp/linkis/").getValue)

val ENGINECONN_ENVKEYS = CommonVars("wds.linkis.engineconn.env.keys", "").getValue

def getEngineEnvValue(envKey:String): String = {
CommonVars(envKey, "").getValue
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package com.webank.wedatasphere.linkis.ecm.core.launch

import java.io.{File, InputStream, OutputStream}
import java.net.ServerSocket

import com.webank.wedatasphere.linkis.common.conf.CommonVars
import com.webank.wedatasphere.linkis.common.exception.ErrorException
import com.webank.wedatasphere.linkis.common.utils.{Logging, Utils}
Expand All @@ -28,7 +27,7 @@ import com.webank.wedatasphere.linkis.governance.common.conf.GovernanceCommonCon
import com.webank.wedatasphere.linkis.governance.common.utils.{EngineConnArgumentsBuilder, EngineConnArgumentsParser}
import com.webank.wedatasphere.linkis.manager.engineplugin.common.conf.EnvConfiguration
import com.webank.wedatasphere.linkis.manager.engineplugin.common.launch.entity.EngineConnLaunchRequest
import com.webank.wedatasphere.linkis.manager.engineplugin.common.launch.process.Environment._
import com.webank.wedatasphere.linkis.manager.engineplugin.common.launch.process.Environment.{ENGINECONN_ENVKEYS, _}
import com.webank.wedatasphere.linkis.manager.engineplugin.common.launch.process.LaunchConstants._
import com.webank.wedatasphere.linkis.manager.engineplugin.common.launch.process.{Environment, ProcessEngineConnLaunchRequest}
import org.apache.commons.io.{FileUtils, IOUtils}
Expand Down Expand Up @@ -87,6 +86,8 @@ trait ProcessEngineConnLaunch extends EngineConnLaunch with Logging {
case HADOOP_CONF_DIR => putIfExists(HADOOP_CONF_DIR)
case HIVE_CONF_DIR => putIfExists(HIVE_CONF_DIR)
case RANDOM_PORT => environment.put(RANDOM_PORT.toString, findAvailPort().toString)
case ENGINECONN_ENVKEYS => environment.put(ENGINECONN_ENVKEYS.toString, GovernanceCommonConf.ENGINECONN_ENVKEYS.toString)

case _ =>
}
}
Expand Down Expand Up @@ -167,6 +168,17 @@ trait ProcessEngineConnLaunch extends EngineConnLaunch with Logging {
}
processBuilder.setEnv(CLASSPATH.toString, processBuilder.replaceExpansionMarker(classPath.replaceAll(CLASS_PATH_SEPARATOR, File.pathSeparator)))

val engineConnEnvKeys = request.environment.remove(ENGINECONN_ENVKEYS.toString)
logger.debug(s"ENGINECONN_ENVKEYS: " + engineConnEnvKeys)
//set other env
val engineConnEnvKeyArray = engineConnEnvKeys.split(",")
engineConnEnvKeyArray.foreach(envKey => {
if(null != envKey && !"".equals(envKey.trim)) {
processBuilder.setEnv(envKey, GovernanceCommonConf.getEngineEnvValue(envKey))
}
})


engineConnManagerEnv.linkDirs.foreach{case (k, v) => processBuilder.link(k, v)}
val execCommand = request.commands.map(processBuilder.replaceExpansionMarker(_)) ++ getCommandArgs
//execCommand = sudoCommand(request.user, execCommand.mkString(" "))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ object Environment extends Enumeration {
type Environment = Value
val USER, ECM_HOME, PWD, PATH, SHELL, JAVA_HOME, CLASSPATH,
HADOOP_HOME, HADOOP_CONF_DIR, HIVE_CONF_DIR, LOG_DIRS, TEMP_DIRS,
ECM_HOST, ECM_PORT, RANDOM_PORT, SERVICE_DISCOVERY = Value
ECM_HOST, ECM_PORT, RANDOM_PORT, SERVICE_DISCOVERY,ENGINECONN_ENVKEYS = Value

def variable(environment: Environment): String = LaunchConstants.EXPANSION_MARKER_LEFT + environment + LaunchConstants.EXPANSION_MARKER_RIGHT

Expand Down