cucumber hadoop:如何从hdfs位置读取cucumber特性文件?

ldfqzlk8  于 2021-06-01  发布在  Hadoop
关注(0)|答案(1)|浏览(451)

我正在使用 import cucumber.api.cli.Main 方法调用 cucumber 主方法如

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返回输入流和文件系统。这个问题有解决办法吗?
更多参考-当我使用“spark submit--master yarn--deploy mode cluster”时,这个问题就存在了。
对于“spark submit--master yarn--deploy mode client”,它工作得很好。

zbsbpyhn

zbsbpyhn1#

下面是我的问题的答案,提供所有特性文件,使用

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在数组中使用。得到如下结果:

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

相关问题