Dataproc 不会解压缩作为存档传递的文件

Dataproc does not unpack files passed as Archive

我正在尝试使用 .NET spark 作业提交 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

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

根据--archives标志的使用帮助:

 --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.txtdeps.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

正如@dagang 提到的 --archives--files 参数不会将 zip 文件复制到驱动程序实例,所以这是错误的方向。

我使用了这种方法:

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 \
        -- /bin/sh -c "gsutil cp gs://<bucket>/builds/test.zip . && unzip -n test.zip && chmod +x ./Spark.Job.Test && ./Spark.Job.Test"