diff --git a/tests/executors/test_celery_executor.py b/tests/executors/test_celery_executor.py index aeaad37eaca39..7d5e2c8b7a34f 100644 --- a/tests/executors/test_celery_executor.py +++ b/tests/executors/test_celery_executor.py @@ -18,6 +18,7 @@ import contextlib import json import os +import signal import sys import unittest from datetime import datetime, timedelta @@ -503,17 +504,9 @@ def apply_async(self, *args, **kwargs): return 1 -import signal - -def handle_pdb(sig, frame): - print('handle_pdb') - import pdb - pdb.Pdb().set_trace(frame) - -signal.signal(signal.SIGUSR1, handle_pdb) def test_send_tasks_to_celery_hang(): - def _exit_gracefully(signum, frame): + def _exit_gracefully(signum, _): print(f"{os.getpid()} Exiting gracefully upon receiving signal {signum}") sys.exit(signum) @@ -558,6 +551,6 @@ def register_signals(): (None, None, None, None, MockTask()), ] - results = executor._send_tasks_to_celery(task_tuples_to_send) - - assert results == [(None, None, 1) for _ in task_tuples_to_send] + for _ in range(500): + results = executor._send_tasks_to_celery(task_tuples_to_send) + assert results == [(None, None, 1) for _ in task_tuples_to_send]