From b593eb74ef2c727ecafc1215f40e266a48476407 Mon Sep 17 00:00:00 2001 From: Qing Wang Date: Wed, 5 Jul 2023 14:32:43 +0800 Subject: [PATCH] Fix and work. Signed-off-by: Qing Wang --- fed/cleanup.py | 5 +++-- tests/test_repeat_init.py | 7 ------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/fed/cleanup.py b/fed/cleanup.py index a770094..8e543c0 100644 --- a/fed/cleanup.py +++ b/fed/cleanup.py @@ -110,12 +110,13 @@ def notify_to_exit(): def wait_sending(): global _check_send_thread - if _check_send_thread: + if _check_send_thread is not None: notify_to_exit() _check_send_thread.join() _check_send_thread = None + global _sending_obj_refs_q + if _sending_obj_refs_q is not None: # It's safe to reset `_sending_obj_refs_q` as another # thread is stoped. - global _sending_obj_refs_q _sending_obj_refs_q = None diff --git a/tests/test_repeat_init.py b/tests/test_repeat_init.py index 42eaa74..2f6e9d5 100644 --- a/tests/test_repeat_init.py +++ b/tests/test_repeat_init.py @@ -51,13 +51,6 @@ def _run(): assert fed.cleanup._sending_obj_refs_q is None compatible_utils.init_ray(address='local') fed.init(cluster=cluster, party=party) - _start_check_sending() - time.sleep(0.5) - assert fed.cleanup._sending_obj_refs_q is not None - push_to_sending(True) - # Slightly longer than the queue polling - time.sleep(0.6) - assert fed.cleanup._sending_obj_refs_q is None my1 = My.party("alice").remote() my2 = My.party("bob").remote()