在 AWS EMR 集群上使用 SparkLauncher 时缺少 SPARK_HOME [英] Missing SPARK_HOME when using SparkLauncher on AWS EMR cluster
本文介绍了在 AWS EMR 集群上使用 SparkLauncher 时缺少 SPARK_HOME的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将 EMR 5.0 与 Spark 2.0.0 一起使用.我正在尝试使用 org.apache.spark.launcher.SparkLauncher
I am using EMR 5.0 with Spark 2.0.0. I am trying to run child spark application from Scala spark application using org.apache.spark.launcher.SparkLauncher
我需要使用 setSparkHome 设置 SPARK_HOME:
I need to set SPARK_HOME using setSparkHome:
var handle = new SparkLauncher()
.setAppResource("s3://my-bucket/python_code.py")
.setAppName("PythonAPP")
.setMaster("spark://" + sparkSession.conf.get("spark.driver.host") +":"+ sparkSession.conf.get("spark.driver.port"))
.setVerbose(true)
.setConf(SparkLauncher.EXECUTOR_CORES, "1")
.setSparkHome("/srv/spark") // not working
.setDeployMode("client")
.startApplication(
new SparkAppHandle.Listener() {
override def infoChanged(hndl: SparkAppHandle): Unit = {
System.out.println(hndl.getState() + " new state !")
}
override def stateChanged(hndl: SparkAppHandle): Unit = {
System.out.println(hndl.getState() + " new state !")
}
})
在哪里可以找到我的 Spark Home 的合适路径?集群由 1 个 Master、1 个 Core 和 1 个 Task 服务器构建而成.
Where can I find the appropriate path to my Spark Home ? The cluster is built from 1 Master, 1 Core and 1 Task servers.
谢谢!
推荐答案
从 emr-4.0.0 开始,EMR 上的所有应用程序都在/usr/lib 中.Spark 在/usr/lib/spark 中.
As of emr-4.0.0, all applications on EMR are in /usr/lib. Spark is in /usr/lib/spark.
这篇关于在 AWS EMR 集群上使用 SparkLauncher 时缺少 SPARK_HOME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文