galafis commented on issue #50958:
URL: https://github.com/apache/airflow/issues/50958#issuecomment-4068218953

   I looked into this and the issue makes sense — the `SparkSubmitHook` 
currently doesn't expose a mechanism for custom post-execution cleanup 
commands, unlike `KubernetesPodOperator` which already supports 
`on_finish_action` and sidecar termination strategies.
   
   The relevant code is in 
`providers/apache-spark/src/airflow/providers/apache/spark/hooks/spark_submit.py`.
 The `on_kill` method handles `SIGTERM` for the Spark driver process, but 
there's no hook point for running additional cleanup commands (e.g., sending a 
`POST` to `localhost:15020/quitquitquit` for Istio sidecar termination).
   
   A reasonable approach would be to add an optional `post_submit_commands` or 
`on_finish_callbacks` parameter to `SparkSubmitHook` that gets executed after 
the Spark job completes (or on kill), similar to how `KubernetesPodOperator` 
handles sidecar containers.
   
   I'd like to take this on and submit a PR. Will start by reviewing the 
existing `KubernetesPodOperator` sidecar handling to align the implementation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to