Skip to content

Conversation

@wForget
Copy link
Member

@wForget wForget commented Jan 21, 2022

Why are the changes needed?

Implement KyuubiHistoryServerPlugin. #1816

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
    SparkUI:
    sparkui001
    sparkui002

SparkHistoryServer:
history001
history002

  • Run test locally before make a pull request

@wForget wForget marked this pull request as draft January 21, 2022 09:52
@wForget wForget marked this pull request as ready for review January 26, 2022 07:34
# Conflicts:
#	externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala
@codecov-commenter
Copy link

codecov-commenter commented Jan 26, 2022

Codecov Report

Merging #1820 (0aecc30) into master (53d59a0) will increase coverage by 0.09%.
The diff coverage is 52.23%.

❗ Current head 0aecc30 differs from pull request most recent head 256363d. Consider uploading reports for the commit 256363d to get more accurate results

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1820      +/-   ##
============================================
+ Coverage     59.46%   59.56%   +0.09%     
+ Complexity      272      268       -4     
============================================
  Files           277      284       +7     
  Lines         13853    14027     +174     
  Branches       1776     1784       +8     
============================================
+ Hits           8238     8355     +117     
- Misses         4911     4959      +48     
- Partials        704      713       +9     
Impacted Files Coverage Δ
...g/apache/kyuubi/engine/spark/KyuubiSparkUtil.scala 88.46% <ø> (ø)
...rg/apache/spark/ui/KyuubiHistoryServerPlugin.scala 0.00% <0.00%> (ø)
.../scala/org/apache/spark/ui/EngineSessionPage.scala 2.89% <5.26%> (-0.18%) ⬇️
...che/spark/kyuubi/SparkSQLEngineEventListener.scala 40.62% <40.62%> (ø)
...ache/kyuubi/engine/spark/events/SessionEvent.scala 79.16% <50.00%> (-7.79%) ⬇️
...uubi/engine/spark/events/SparkOperationEvent.scala 86.48% <50.00%> (-2.41%) ⬇️
...src/main/scala/org/apache/spark/ui/EngineTab.scala 70.73% <63.15%> (-1.69%) ⬇️
...kyuubi/engine/spark/events/EngineEventsStore.scala 80.00% <77.77%> (-6.67%) ⬇️
...rg/apache/kyuubi/engine/spark/SparkSQLEngine.scala 68.53% <92.30%> (+2.27%) ⬆️
...a/org/apache/spark/kyuubi/SparkContextHelper.scala 64.70% <100.00%> (+4.70%) ⬆️
... and 29 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 53d59a0...256363d. Read the comment docs.

@wForget wForget changed the title [WIP][KYUUBI #1816] Implement KyuubiHistoryServerPlugin [KYUUBI #1816] Implement KyuubiHistoryServerPlugin Jan 26, 2022
@wForget
Copy link
Member Author

wForget commented Jan 26, 2022

Hi @yaooqinn , this implementation seems feasible. Can you help me review it?

@yaooqinn
Copy link
Member

thanks, @wForget for the great job, will take a look tomorrow

@yaooqinn yaooqinn requested a review from ulysses-you January 26, 2022 11:46
@yaooqinn
Copy link
Member

also cc @turboFei @ulysses-you


def endTime(): Long = engine.map(_ => System.currentTimeMillis()).getOrElse {
sparkUI
.map(ui => ui.store.applicationInfo().attempts.head.endTime.getTime)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the start/end Time always use the first attempt?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* The number of SQL client sessions kept in the Kyuubi Query Engine web UI.
*/
private val retainedSessions: Int = {
sparkConf.getOption(SQLConf.THRIFTSERVER_UI_SESSION_LIMIT.key) match {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we simply use kyuubiConf?


class KyuubiHistoryServerPlugin extends AppHistoryServerPlugin {

def kyuubiConf: KyuubiConf = KyuubiConf()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private?


class KyuubiHistoryServerPlugin extends AppHistoryServerPlugin {

def kyuubiConf: KyuubiConf = KyuubiConf()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we also load kyuubi configurations from sparkConf like SparkSQLEngine?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, I will load the kyuubi configurations from sparkConf and only use kyuubiConf.

@yaooqinn
Copy link
Member

yaooqinn commented Feb 8, 2022

Hi @yaooqinn , this implementation seems feasible. Can you help me review it?

sorry for the late reply, plans were disrupted by omicron in HZ.

@yaooqinn yaooqinn added this to the v1.5.0 milestone Feb 9, 2022
@yaooqinn yaooqinn added the kind:feature Feature request label Feb 9, 2022
import org.apache.kyuubi.config.KyuubiConf
import org.apache.kyuubi.engine.spark.events.EngineEventsStore

class KyuubiHistoryServerPlugin extends AppHistoryServerPlugin {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some comments about how to use this class ? It should work with history server together.

}

override def setupUI(ui: SparkUI): Unit = {
addKyuubiConfFromSpark(ui.conf)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like we should build kyuubi conf for every Spark app UI instead of use a global kyuubi conf.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like we should build kyuubi conf for every Spark app UI instead of use a global kyuubi conf.

These sparkConf seem to be the same object, should we create multiple kyuubiConf?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we need to get the configuration of different spark app, we can get it using org.apache.spark.status.AppStatusStore#environmentInfo, do we need to do that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These sparkConf seem to be the same object, should we create multiple kyuubiConf?

I just check the Spark build-in plugin, do not see a global value. The code is confused if the input conf is always same. It's better to craete multiple kyuubiConf.

If we need to get the configuration of different spark app, we can get it using org.apache.spark.status.AppStatusStore#environmentInfo, do we need to do that?

It seems trivial, we dont need to update.

</ul>
}
private def generateBasicStats(): Seq[Node] =
if (parent.engine != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the type of parent.engine is Option ?

@wForget wForget requested a review from ulysses-you February 9, 2022 10:39
@ulysses-you
Copy link
Contributor

thanks, merging to master

@theoctober19th
Copy link

Hi, do we have a documentation for how to use this extension yet?

@wForget
Copy link
Member Author

wForget commented May 14, 2024

Hi, do we have a documentation for how to use this extension yet?

There is usage in comment of KyuubiHistoryServerPlugin.scala

/**
* HistoryServer plugin for Kyuubi, It can be used as a plugin in SparkHistoryServer to make SparkHistoryServer UI display Kyuubi's Tab.
* We can use it like:
* - Copy the kyuubi-spark-sql-engine jar to $SPARK_HOME/jars and restart SparkHistoryServer.
* - In addition, we can add kyuubi configurations to spark-defaults.conf prefixed with "spark.kyuubi.".
*/

@wForget
Copy link
Member Author

wForget commented May 14, 2024

Just copy kyuubi-spark-sql-engine.jar to $SPARK_HOME/jars of SparkHistoryServer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:feature Feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants