spark-shell 执行脚本并传入参数


使用方法:

./spark-script.sh your_file.scala first_arg second_arg third_arg


脚本

scala_file=$1

shift 1

arguments=$@

#set +o posix  # to enable process substitution when not running on bash 

spark-shell  --master yarn --deploy-mode client \
         --queue default \
        --driver-memory 2G --executor-memory 4G \
        --num-executors 10 \
        -i <(echo 'val args = "'$arguments'".split("\\s+")' ; cat $scala_file)

linux shell 重定向:

Command < filename > filename2 Command命令以filename文件作为标准输入,以filename2文件作为标准输出

 

 

参考文献:

http://stackoverflow.com/questions/29928999/passing-command-line-arguments-to-spark-shell


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM