首页 > 解决方案 > Dataproc 不会解压缩作为存档传递的文件

问题描述

我正在尝试使用 .NET spark Job 提交 Dataproc。

命令行如下所示:

gcloud dataproc jobs submit spark \
    --cluster=<cluster> \
    --region=<region> \
    --class=org.apache.spark.deploy.dotnet.DotnetRunner \
    --jars=gs://bucket/microsoft-spark-2.4.x-0.11.0.jar \
    --archives=gs://bucket/dotnet-build-output.zip \
    -- find

此命令行应调用find函数以显示当前目录中的文件。

我只看到 2 个文件:

././microsoft-spark-2.4.x-0.11.0.jar
././microsoft-spark-2.4.x-0.11.0.jar.crc

最终 GCP 不会从指定为--archives. 指定的文件存在并且路径是从 GCP UI 复制的。我也尝试从存档(存在)中运行一个确切的程序集文件,但它合理地失败了File does not exist

标签: .netapache-sparkgoogle-cloud-platformgoogle-cloud-dataproc

解决方案


我认为问题在于您的命令在主节点上运行的 Spark 驱动程序中运行,因为 Dataproc 默认以客户端模式运行。您可以通过--properties spark.submit.deployMode=cluster在提交作业时添加来更改它。

根据--archivesflag的使用帮助:

 --archives=[ARCHIVE,...]
   Comma separated list of archives to be extracted into the working
   directory of each executor. Must be one of the following file formats:
   .zip, .tar, .tar.gz, or .tgz.

存档只会被提取到工作节点中。我测试了提交一个--archives=gs://my-bucket/foo.zip包含 2 个文件foo.txt和的作业deps.txt,然后我可以在工作节点上找到提取的文件:

my-cluster-w-0:~$ sudo ls -l /hadoop/yarn/nm-local-dir/usercache/root/filecache/40/foo.zip/

total 4
-r-x------ 1 yarn yarn 11 Jul  2 22:09 deps.txt
-r-x------ 1 yarn yarn  0 Jul  2 22:09 foo.txt

推荐阅读