티스토리 뷰

Spark Application 을 작성하게 되면 실행시 argument 가 필요한 경우가 있다.
spark-class 에서는 -arg 옵션을 통해서 전달했는데, spark-submit 에서는 어떻게 할 수 있을까?


Spark 문서(위 URL 참고) 에 보면 아래와 같이 설명하고 있다.

./bin/spark-submit \
  --class <main-class>
  --master <master-url> \
  --deploy-mode <deploy-mode> \
  --conf <key>=<value> \
  ... # other options
  <application-jar> \
  [application-arguments]

[application-arguments]
즉, command 마지막 부분에 argument 들을 나열하면 순서대로 main함수에 args 배열을 통해 전달된다.

추가적으로 각 옵션에 대해서 아래와 같이 설명하고 있다.

--class: The entry point for your application (e.g.org.apache.spark.examples.SparkPi)
--master: Themaster URLfor the cluster (e.g.spark://23.195.26.187:7077)
--deploy-mode: Whether to deploy your driver on the worker nodes (cluster) or locally as an external client (client) (default:client)*
--conf: Arbitrary Spark configuration property in key=value format. For values that contain spaces wrap ¡°key=value¡± in quotes (as shown).
application-jar: Path to a bundled jar including your application and all dependencies. The URL must be globally visible inside of your cluster, for instance, anhdfs://path or afile://path that is present on all nodes.
application-arguments: Arguments passed to the main method of your main class, if any

참고 yarn 환경에서 --master 의 값은 yarn-cluster 또는 yarn-client 가 될 수 있다. 
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함