【发布时间】:2015-07-14 21:06:24
【问题描述】:
我正在编写一个简单的 spark 应用程序,它使用一些输入 RDD,通过管道将其发送到外部脚本,并将该脚本的输出写入文件。驱动代码如下:
val input = args(0)
val scriptPath = args(1)
val output = args(2)
val sc = getSparkContext
if (args.length == 4) {
//Here I pass an additional argument which contains an absolute path to a script on my local machine, only for local testing
sc.addFile(args(3))
}
sc.textFile(input).pipe(Seq("python2", SparkFiles.get(scriptPath))).saveAsTextFile(output)
当我在本地机器上运行它时,它运行良好。但是当我通过
将它提交到YARN集群时spark-submit --master yarn --deploy-mode cluster --files /absolute/path/to/local/test.py --class somepackage.PythonLauncher path/to/driver.jar path/to/input/part-* test.py path/to/output`
异常失败。
Lost task 1.0 in stage 0.0 (TID 1, rwds2.1dmp.ru): java.lang.Exception: Subprocess exited with status 2
我尝试了管道命令的不同变体。例如,.pipe("cat") 工作正常,并且按预期运行,但 .pipe(Seq("cat", scriptPath)) 也失败并显示错误代码 1,因此 spark 似乎无法找出集群节点上脚本的路径。
有什么建议吗?
【问题讨论】:
-
这方面有什么更新吗?
标签: apache-spark hdfs hadoop-yarn