This is an automated email from the ASF dual-hosted git repository.
husseinawala pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 47187cea8b Increase timeout for `spawn` mp method in
`TestSigtermOnRunner` test (#33470)
47187cea8b is described below
commit 47187cea8b49df9048235c9402c0e21d46175d3b
Author: Andrey Anshin <[email protected]>
AuthorDate: Thu Aug 17 20:57:34 2023 +0400
Increase timeout for `spawn` mp method in `TestSigtermOnRunner` test
(#33470)
---
tests/jobs/test_local_task_job.py | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/tests/jobs/test_local_task_job.py
b/tests/jobs/test_local_task_job.py
index 61ffe10adb..33c431e97c 100644
--- a/tests/jobs/test_local_task_job.py
+++ b/tests/jobs/test_local_task_job.py
@@ -864,15 +864,20 @@ class TestSigtermOnRunner:
"daemon", [pytest.param(True, id="daemon"), pytest.param(False,
id="non-daemon")]
)
@pytest.mark.parametrize(
- "mp_method",
+ "mp_method, wait_timeout",
[
pytest.param(
- "fork", marks=pytest.mark.skipif(not hasattr(os, "fork"),
reason="Forking not available")
+ "fork",
+ 10,
+ marks=pytest.mark.skipif(not hasattr(os, "fork"),
reason="Forking not available"),
+ id="fork",
),
- pytest.param("spawn"),
+ pytest.param("spawn", 30, id="spawn"),
],
)
- def test_process_sigterm_works_with_retries(self, mp_method, daemon,
clear_db, request, capfd):
+ def test_process_sigterm_works_with_retries(
+ self, mp_method, wait_timeout, daemon, clear_db, request, capfd
+ ):
"""Test that ensures that task runner sets tasks to retry when task
runner receive SIGTERM."""
mp_context = mp.get_context(mp_method)
@@ -896,12 +901,12 @@ class TestSigtermOnRunner:
proc.start()
try:
- with timeout(10, "Timeout during waiting start LocalTaskJob"):
+ with timeout(wait_timeout, "Timeout during waiting start
LocalTaskJob"):
while task_started.value == 0:
time.sleep(0.2)
os.kill(proc.pid, signal.SIGTERM)
- with timeout(10, "Timeout during waiting callback"):
+ with timeout(wait_timeout, "Timeout during waiting callback"):
while retry_callback_called.value == 0:
time.sleep(0.2)
finally:
@@ -954,7 +959,7 @@ class TestSigtermOnRunner:
is_started.value = 1
while True:
- time.sleep(0.1)
+ time.sleep(0.25)
with DAG(dag_id=dag_id, schedule=None, start_date=execution_date) as
dag:
task = PythonOperator(