From 461fba2df5b7b0f661570a8dc9e49fcd84f7bf86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cv=5Fkkhuang=E2=80=9D?= <“420895376@qq.com”> Date: Fri, 17 Jan 2025 09:53:42 +0800 Subject: [PATCH] support spark3 --- .../entrance/parser/CommonEntranceParser.scala | 17 +++++++++++++++-- .../manager/label/conf/LabelCommonConfig.java | 2 +- .../label/utils/EngineTypeLabelCreator.java | 14 ++++++++++++++ linkis-engineconn-plugins/spark/pom.xml | 9 +++++++++ pom.xml | 9 ++++++--- 5 files changed, 45 insertions(+), 6 deletions(-) diff --git a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/parser/CommonEntranceParser.scala b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/parser/CommonEntranceParser.scala index 58fc1f45c3..90974ff08a 100644 --- a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/parser/CommonEntranceParser.scala +++ b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/parser/CommonEntranceParser.scala @@ -35,10 +35,15 @@ import org.apache.linkis.manager.label.conf.LabelCommonConfig import org.apache.linkis.manager.label.constant.LabelKeyConstant import org.apache.linkis.manager.label.entity.Label import org.apache.linkis.manager.label.entity.cluster.ClusterLabel -import org.apache.linkis.manager.label.entity.engine.{CodeLanguageLabel, UserCreatorLabel} +import org.apache.linkis.manager.label.entity.engine.{ + CodeLanguageLabel, + EngineType, + UserCreatorLabel +} import org.apache.linkis.manager.label.utils.EngineTypeLabelCreator import org.apache.linkis.protocol.constants.TaskConstant import org.apache.linkis.scheduler.queue.SchedulerEventState +import org.apache.linkis.storage.script.VariableParser import org.apache.commons.lang3.StringUtils @@ -265,9 +270,17 @@ class CommonEntranceParser(val persistenceManager: PersistenceManager) if (formatCode) executionCode = format(executionCode) jobReq.setExecutionCode(executionCode) } - val engineTypeLabel = EngineTypeLabelCreator.createEngineTypeLabel(executeApplicationName) + var engineTypeLabel = EngineTypeLabelCreator.createEngineTypeLabel(executeApplicationName) val runTypeLabel = labelBuilderFactory.createLabel[Label[_]](LabelKeyConstant.CODE_TYPE_KEY, runType) + val variableMap = + jobReq.getParams.get(VariableParser.VARIABLE).asInstanceOf[util.Map[String, String]] + if (variableMap.containsKey(LabelCommonConfig.SPARK3_ENGINE_VERSION)) { + engineTypeLabel = EngineTypeLabelCreator.createEngineTypeLabel( + EngineType.SPARK.toString, + variableMap.get(LabelCommonConfig.SPARK3_ENGINE_VERSION) + ) + } val userCreatorLabel = labelBuilderFactory .createLabel[Label[_]](LabelKeyConstant.USER_CREATOR_TYPE_KEY, umUser + "-" + creator) diff --git a/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/conf/LabelCommonConfig.java b/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/conf/LabelCommonConfig.java index 3304b45100..abe7bebd8c 100644 --- a/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/conf/LabelCommonConfig.java +++ b/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/conf/LabelCommonConfig.java @@ -35,7 +35,7 @@ public class LabelCommonConfig { public static final CommonVars SPARK_ENGINE_VERSION = CommonVars.apply("wds.linkis.spark.engine.version", "2.4.3"); - + public static final String SPARK3_ENGINE_VERSION = "linkis.spark3.engine.version"; public static final CommonVars HIVE_ENGINE_VERSION = CommonVars.apply("wds.linkis.hive.engine.version", "2.3.3"); diff --git a/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/utils/EngineTypeLabelCreator.java b/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/utils/EngineTypeLabelCreator.java index dbd8e7e67a..fa690579ed 100644 --- a/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/utils/EngineTypeLabelCreator.java +++ b/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/utils/EngineTypeLabelCreator.java @@ -123,4 +123,18 @@ public static void registerVersion(String type, String version) { } defaultVersion.put(type, version); } + + public static EngineTypeLabel createEngineTypeLabel(String type, String version) { + if (null == defaultVersion) { + init(); + } + EngineTypeLabel label = labelBuilderFactory.createLabel(EngineTypeLabel.class); + label.setEngineType(type); + if (StringUtils.isNotBlank(version)) { + label.setVersion(version); + } else { + defaultVersion.get(type); + } + return label; + } } diff --git a/linkis-engineconn-plugins/spark/pom.xml b/linkis-engineconn-plugins/spark/pom.xml index 03b6620c65..0e61c725ab 100644 --- a/linkis-engineconn-plugins/spark/pom.xml +++ b/linkis-engineconn-plugins/spark/pom.xml @@ -485,6 +485,15 @@ + + spark-3.4 + + 3.4.4 + 2.12.17 + 2.12 + 2.14.2 + + spark-2.4-hadoop-3.3 diff --git a/pom.xml b/pom.xml index d6506881b3..cec9c69286 100644 --- a/pom.xml +++ b/pom.xml @@ -102,7 +102,7 @@ - 1.10.0-wds + 1.10.0-wds-spark 2.9.2 2.4.3 2.7.2 @@ -192,6 +192,7 @@ 1.8 3.5.0 + 3.7.0-M11 2.11.12 2.11 1.10.12 @@ -1490,9 +1491,11 @@ spark-3.2 - 3.2.1 - 2.12.15 + 3.7.0-M11 + 3.4.4 + 2.12.17 2.12 + 2.14.2