Skip to content

Commit

Permalink
Call _send_tasks_to_celery 500 times in test
Browse files Browse the repository at this point in the history
  • Loading branch information
yuqian90 committed May 28, 2021
1 parent 51fdcff commit de7041c
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions tests/executors/test_celery_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import contextlib
import json
import os
import signal
import sys
import unittest
from datetime import datetime, timedelta
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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]

0 comments on commit de7041c

Please sign in to comment.