Allow deleting existing spark application before creating new one via SparkKubernetesOperator in Kubernetes
See original GitHub issueairflow 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:
- Created 2 years ago
- Reactions:5
- Comments:12 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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?Bumping into same issue, would be happy to have it fixed, thanks!