简体   繁体   中英

How to execute multiple spark-submit commands using python script

How to execute multiple spark-submit commands using a python script.

Ex:

spark-submit --class com.demo.DemoApplication1 --master local[2] Demo1.jar
spark-submit --class com.demo.DemoApplication3 --master local[2] Demo2.jar
spark-submit --class com.demo.DemoApplication3 --master local[2] Demo3.jar

you can use os.system() to run your commands using python like this:

import os
os.system('command')

so you can probably just use it like this:

import os
os.system('spark-submit --class com.demo.DemoApplication1 --master local[2] Demo1.jar')
os.system('spark-submit --class com.demo.DemoApplication1 --master local[2] Demo1.jar')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM