Upload zip file using --archives option of spark-submit on yarn

后端 未结 1 1754
难免孤独
难免孤独 2020-12-15 09:20

I have a directory with some model files and my application has to access these models files in local file system due to some reason.

Of course I know that --f

相关标签:
1条回答
  • 2020-12-15 09:57

    Found the answer myself.

    YARN does extract the archive but add an extra folder with the same name of the archive. To make it clear, If I put models/model1 and models/models2 in models.zip, then I have to access my models by models.zip/models/model1 and models.zip/models/model2.

    Moreover, we can make this more beautiful using the # syntax.

    The --files and --archives options support specifying file names with the # similar to Hadoop. For example you can specify: --files localtest.txt#appSees.txt and this will upload the file you have locally named localtest.txt into HDFS but this will be linked to by the name appSees.txt, and your application should use the name as appSees.txt to reference it when running on YARN.

    Edit:

    This answer was tested on spark 2.0.0 and I'm not sure the behavior in other versions.

    0 讨论(0)
提交回复
热议问题