Skip to content

Commit

Permalink
[KYUUBI apache#4541] Support to customize the attributes to expose fo…
Browse files Browse the repository at this point in the history
…r Spark engine

### _Why are the changes needed?_

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [ ] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request

Closes apache#4541 from turboFei/expose.

Closes apache#4541

f882b4d [fwang12] engine register attributes

Authored-by: fwang12 <fwang12@ebay.com>
Signed-off-by: fwang12 <fwang12@ebay.com>
  • Loading branch information
turboFei committed Mar 23, 2023
1 parent 3771dc9 commit e39bdda
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import org.apache.spark.SparkContext
import org.apache.spark.kyuubi.SparkContextHelper

import org.apache.kyuubi.{KyuubiSQLException, Logging}
import org.apache.kyuubi.config.KyuubiConf
import org.apache.kyuubi.config.KyuubiReservedKeys._
import org.apache.kyuubi.ha.client.{EngineServiceDiscovery, ServiceDiscovery}
import org.apache.kyuubi.service.{Serverable, Service, TBinaryFrontendService}
Expand Down Expand Up @@ -94,8 +95,10 @@ class SparkTBinaryFrontendService(
}

override def attributes: Map[String, String] = {
val attributes = Map(
KYUUBI_ENGINE_ID -> KyuubiSparkUtil.engineId)
val extraAttributes = conf.get(KyuubiConf.ENGINE_SPARK_REGISTER_ATTRIBUTES).map { attr =>
attr -> KyuubiSparkUtil.globalSparkContext.getConf.get(attr, "")
}.toMap
val attributes = extraAttributes ++ Map(KYUUBI_ENGINE_ID -> KyuubiSparkUtil.engineId)
// TODO Support Spark Web UI Enabled SSL
sc.uiWebUrl match {
case Some(url) => attributes ++ Map(KYUUBI_ENGINE_URL -> url.split("//").last)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2764,6 +2764,15 @@ object KyuubiConf {
.stringConf
.createWithDefault("bin/python")

val ENGINE_SPARK_REGISTER_ATTRIBUTES: ConfigEntry[Seq[String]] =
buildConf("kyuubi.engine.spark.register.attributes")
.internal
.doc("The extra attributes to expose when registering for Spark engine.")
.version("1.8.0")
.stringConf
.toSequence()
.createWithDefault(Seq("spark.driver.memory", "spark.executor.memory"))

val ENGINE_HIVE_EVENT_LOGGERS: ConfigEntry[Seq[String]] =
buildConf("kyuubi.engine.hive.event.loggers")
.doc("A comma-separated list of engine history loggers, where engine/session/operation etc" +
Expand Down

0 comments on commit e39bdda

Please sign in to comment.