when run the code in k8s ,  driver pod throw AnalysisException , but  the 
spark-submit log still  running , then how to get the exception and stop pods ?


val spark = SparkSession.builder().getOrCreate()
    import spark.implicits._
    val df = (0 until 100000).toDF("id").selectExpr("id % 5 as key", "id%10 as 
value")
      .groupBy("key").agg(count("value1").as("cnt"))
    df.show()
spark.stop()


bin/spark-submit \
--master k8s://https://localhost:9443 \
--deploy-mode cluster \
--name wordcount \
--class k8s.WordCount \
--conf spark.kubernetes.container.image=rspark:v3.1.1 \
--conf spark.kubernetes.container.image.pullPolicy=IfNotPresent \
--conf spark.kubernetes.authenticate.driver.serviceAccountName=spark \
--conf spark.kubernetes.file.upload.path=hdfs://localhost:8020/data/spark \
/data/spark-example-1.0.0.jar

Reply via email to