Skip to content

Commit

Permalink
code opmitization
Browse files Browse the repository at this point in the history
  • Loading branch information
v-kkhuang committed Sep 11, 2023
1 parent a7d2c07 commit b12915a
Showing 1 changed file with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,20 +53,11 @@ class SparkSubmitProcessEngineConnLaunchBuilder(builder: JavaProcessEngineConnLa
gcLogDir: String,
logDir: String
): Array[String] = {
val userEngineResource = engineConnBuildRequest.engineResource
val darResource = userEngineResource.getLockedResource.asInstanceOf[DriverAndYarnResource]
val properties = engineConnBuildRequest.engineConnCreationDesc.properties

val className = getValueAndRemove(properties, "className", mainClass)
val driverCores = getValueAndRemove(properties, LINKIS_SPARK_DRIVER_CORES)
val driverMemory = getValueAndRemove(properties, LINKIS_SPARK_DRIVER_MEMORY)
val executorCores = getValueAndRemove(properties, LINKIS_SPARK_EXECUTOR_CORES)
val executorMemory = getValueAndRemove(properties, LINKIS_SPARK_EXECUTOR_MEMORY)
val numExecutors = getValueAndRemove(properties, LINKIS_SPARK_EXECUTOR_INSTANCES)
val sparkcsonf = getValueAndRemove(properties, LINKIS_SPARK_CONF)
val sparkConf = getValueAndRemove(properties, LINKIS_SPARK_CONF)
// sparkcsonf DEMO:spark.sql.shuffle.partitions=10;spark.memory.fraction=0.6
if (StringUtils.isNotBlank(sparkcsonf)) {
val strArrary = sparkcsonf.split(";").toList
if (StringUtils.isNotBlank(sparkConf)) {
val strArrary = sparkConf.split(";").toList
strArrary.foreach { keyAndValue =>
val key = keyAndValue.split("=")(0).trim
val value = keyAndValue.split("=")(1).trim
Expand All @@ -77,7 +68,15 @@ class SparkSubmitProcessEngineConnLaunchBuilder(builder: JavaProcessEngineConnLa
}
}
}
val className = getValueAndRemove(properties, "className", mainClass)
val driverCores = getValueAndRemove(properties, LINKIS_SPARK_DRIVER_CORES)
val driverMemory = getValueAndRemove(properties, LINKIS_SPARK_DRIVER_MEMORY)
val executorCores = getValueAndRemove(properties, LINKIS_SPARK_EXECUTOR_CORES)
val executorMemory = getValueAndRemove(properties, LINKIS_SPARK_EXECUTOR_MEMORY)
val numExecutors = getValueAndRemove(properties, LINKIS_SPARK_EXECUTOR_INSTANCES)

val userEngineResource = engineConnBuildRequest.engineResource
val darResource = userEngineResource.getLockedResource.asInstanceOf[DriverAndYarnResource]
val files = getValueAndRemove(properties, "files", "").split(",").filter(isNotBlankPath)
val jars = new ArrayBuffer[String]()
jars ++= getValueAndRemove(properties, "jars", "").split(",").filter(isNotBlankPath)
Expand Down

0 comments on commit b12915a

Please sign in to comment.