HsiuChuanHsu commented on PR #56402:
URL: https://github.com/apache/airflow/pull/56402#issuecomment-3368690484
**Tests:**
Set the `termination_grace_period` to 3, 300, and the default across three
different DAGs, and the pod's terminationGracePeriodSeconds is correctly set
now.
```python
# test_kpo_termination_grace_period_3s
test_3s_grace_period = KubernetesPodOperator(
namespace="default",
image="ubuntu:22.04",
cmds=["bash", "-cx"],
arguments=["echo 'Testing termination_grace_period=3'; sleep 5; echo
'Done'"],
labels={"test": "termination-grace-period"},
name="test-grace-period-3",
task_id="test_grace_period_3_seconds",
termination_grace_period=3,
get_logs=True,
)
# test_kpo_termination_grace_period_300s
test_300s_grace_period = KubernetesPodOperator(
namespace="default",
image="ubuntu:22.04",
cmds=["bash", "-cx"],
arguments=["echo 'Testing termination_grace_period=300'; sleep 5;
echo 'Done'"],
labels={"test": "termination-grace-period"},
name="test-grace-period-300",
task_id="test_grace_period_300_seconds",
termination_grace_period=300,
get_logs=True,
)
# test_kpo_termination_grace_period_default
test_default_grace_period = KubernetesPodOperator(
namespace="default",
image="ubuntu:22.04",
cmds=["bash", "-cx"],
arguments=["echo 'Testing default termination_grace_period'; sleep
5; echo 'Done'"],
labels={"test": "termination-grace-period"},
name="test-grace-period-default",
task_id="test_grace_period_default",
# No termination_grace_period specified
get_logs=True,
)
```
<img width="1196" height="281" alt="Screenshot 2025-10-04 at 11 50 18 PM"
src="https://github.com/user-attachments/assets/2c57db3d-6be5-4e51-b79c-ff281771f027"
/>
--
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]