You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "adieldadi (via GitHub)" <gi...@apache.org> on 2025/07/18 00:52:30 UTC

[D] Return task exit code upon graceful termination (KubernetesPodOperator) [airflow]

GitHub user adieldadi created a discussion: Return task exit code upon graceful termination (KubernetesPodOperator)

We are running airflow 2.8.1. 
The scenario is as follows:

- A task is running using the KubernetesPodOperator. The operator has  termination_grace_period=300.
- During the run a SIGTERM sent to terminated the pod (kubectl delete pod $podname -n $workspace
- The task complete successfully within the graceful period


However, Airlow will not receive the result of the task (in our case success), and will fail with 404 error.
We tried to use xcom to return the exit value but this was not successful
Using TERM trap was also not successful - the exit code will not return to Airflow.
 
**Our question:** what is the proper way to receive the exit code to Airflow upon the graceful termination of the pod?

[log-when-issuing-SIGTERM.pdf](https://github.com/user-attachments/files/21307338/log-when-issuing-SIGTERM.pdf)
[log-not-issuing-SIGTERM.pdf](https://github.com/user-attachments/files/21307340/log-not-issuing-SIGTERM.pdf)
[test-script.pdf](https://github.com/user-attachments/files/21307341/test-script.pdf)


GitHub link: https://github.com/apache/airflow/discussions/53481

----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org