如何将Handler附加到sparkUI

时间:2019-06-20 07:28:06

标签: apache-spark

我正在尝试使用以下代码来生成附加处理程序以触发UI:

 private def getSparkUI(sparkContext: SparkContext): SparkUI = {
       sparkContext.ui.getOrElse {
           throw new SparkException("Parent SparkUI to attach this tab to not found!")
       }

}

import org.apache.spark.ui.JettyUtils.createServletHandler
val ui = getSparkUI(sparkContext)
val graphHttpServlet = new GraphHttpServlet("/graph/", sessionUtils)
val handler = createServletHandler("/graph/", graphHttpServlet, "")
ui.attachHandler(handler)

此代码无法编译并出现错误:

Error:(20, 19) Symbol 'type org.eclipse.jetty.servlet.ServletContextHandler' is missing from the classpath.
This symbol is required by 'method org.apache.spark.ui.JettyUtils.createServletHandler'.
Make sure that type ServletContextHandler is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
A full rebuild may help if 'JettyUtils.class' was compiled against an incompatible version of org.eclipse.jetty.servlet.
val handler = createServletHandler("/graph/", graphHttpServlet, "")

我知道Spark可以将码头依赖项封装到一个新程序包中:org.spark_project.jetty.servlet.ServletContextHandler

我还反编译了jar并检查jar是否具有阴影依赖项。

但是为什么编译器看不到呢?我如何附加处理程序?

0 个答案:

没有答案
相关问题