无法从暂存目录读取文件

r7xajy2e  于 2021-05-17  发布在  Spark
关注(0)|答案(0)|浏览(379)

在集群模式下使用spark submit时,我为file提供了--files参数当我在并行窗口中运行list命令时,我可以看到这些文件

  1. $ hdfs dfs -ls /user/name/.sparkStaging/application_1598445422718_5631/
  2. -rw-r--r-- 3 user hadoop 1234 2020-11-18 06:44 /user/name/.sparkStaging/application_1598445422718_5631/survey.properties

我是这样读的:

  1. val props = Source.fromFile(System.getenv("SPARK_YARN_STAGING_DIR")+"/survey.properties")

在日志中我可以看到:

  1. survey.properties -> resource { scheme: "hdfs" host: "myhost" port: -1 file: "/user/name/.sparkStaging/application_1598445422718_5631/survey.properties" } size: 1234timestamp: 1605680821911 type: FILE visibility: PRIVATE

但仍然得到以下错误:

  1. client token: Token { kind: YARN_CLIENT_TOKEN, service: }
  2. diagnostics: User class threw exception: java.io.FileNotFoundException: hdfs:/myhost/user/name/.sparkStaging/application_1598445422718_5631/survey.properties (No such file or directory)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题