question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow deleting existing spark application before creating new one via SparkKubernetesOperator in Kubernetes

See original GitHub issue

airflow version: v2.0.2

Description calling SparkKubernetesOperator within DAG should delete spark application if such already exists before submitting a new one.

Use case / motivation

t1 = SparkKubernetesOperator(
    task_id='spark_pi_submit',
    namespace="dummy",
    application_file="spark.yaml",
    kubernetes_conn_id="kubernetes",
    do_xcom_push=True,
    dag=dag,
)

After first successful run, next runs fail to submit spark application

airflow.exceptions.AirflowException: Exception when calling -> create_custom_object: (409) Reason: Conflict

{“kind”:“Status”,“apiVersion”:“v1”,“metadata”:{},“status”:“Failure”,“message”:“sparkapplications.sparkoperator.k8s.io “xxx” already exists”,“reason”:“AlreadyExists”,“details”:{“name”:“xxx”,“group”:“sparkoperator.k8s.io”,“kind”:“sparkapplications”},“code”:409}

Expected Result

Delete existing spark application if such exists before submitting new one.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:5
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
jherrmannNetfondscommented, Aug 20, 2021

Hi, I modified the SparkKubernetesSensor so it deletes the spark application if it finished successfully. For retry I have {{ task_instance.try_number }} for the SparkApplication name so that I still can have a look at the logs.

My proposal is to add an option to the Sensor to delete the spark application via a flag ALWAYS, ON_FAILURE,ON_SUCCESS. What do you guys think?

0reactions
avinovarovcommented, Mar 29, 2022

Bumping into same issue, would be happy to have it fixed, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[GitHub] [airflow] yevsh opened a new issue #16290
... opened a new issue #16290: Allow deleting existing spark application before creating new one via SparkKubernetesOperator in Kubernetes.
Read more >
spark-on-k8s-operator/user-guide.md at master - GitHub
Creating a New SparkApplication; Deleting a SparkApplication ... When using the spark-submit script to submit a Spark application, such dependencies are ...
Read more >
Running Spark on Kubernetes - Spark 3.3.1 Documentation
Spark creates a Spark driver running within a Kubernetes pod. ... the executor pods may not be properly deleted from the cluster when...
Read more >
Quick Start Guide | spark-on-k8s-operator
Kubernetes operator for managing the lifecycle of Apache Spark applications on Kubernetes.
Read more >
How To Manage And Monitor Apache Spark On Kubernetes
A SparkApplication has the following states shown in the next diagram: When a new application is created after a new custom resource object ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found