Cucumber-Hadoop:如何从 HDFS 位置读取黄瓜功能文件?

Cucumber-Hadoop: How to read cucumber feature files from a HDFS location?

我正在使用 import cucumber.api.cli.Main 方法来调用 cucumber main 方法,例如

Main.main(
    Array(glue,gluePath,tag,tagName,plugin,pluginNameAndPath,
        "hdfs:///user/test/hdfs.feature"))

是否可以从 HDFS 位置读取特征文件,因为它正在使用本地路径?

读取hdfs路径的方法是

val fs = FileSystem.get(new Configuration());
val fsDataInputStream = fs.open(new Path("/user/test/hdfs.feature"))

我也可以将其转换为输入流,但问题是 Array() 只接受字符串和 hdfs reader return 输入流以及文件系统。 这个问题有解决办法吗?

更多参考- 当我使用 "spark-submit --master yarn --deploy-mode cluster".

时存在这个问题

"spark-submit --master yarn --deploy-mode client"。

工作正常

这是我的问题的答案 使用 --files like

提供所有功能文件
spark-submit --master yarn --deploy-mode cluster --queue cbi_ops --driver-memory 10G 
--executor-memory 5G --executor-cores 5 --num-executors 5 \
--jars $jars_path \
--files $files_path \
--driver-class-path xx.jar \
--class RunnerMain \
xx.jar \
"-g" "xx.stepdefinitions" \
"-t" "@functional-test,@regression-test" \

使用

添加代码中的所有文件
sqlContext.sparkContext.addFile(x)

然后通过 SparkFiles.get 在数组中使用,例如:

Array(glue,gluePath,tag,tagName,plugin,pluginNameAndPath,plugin,pluginNameAndPathJson,
            SparkFiles.get("ingestion-mc-ris-r2d-inc.feature"))