From db9942c52e8413fae6965ed67d45ffc48be5371f Mon Sep 17 00:00:00 2001 From: Sergey Vakhreev Date: Wed, 13 Sep 2023 22:07:23 +0930 Subject: [PATCH] Upload proxy as a daemon (#97) * make it daemon, removed extra set_start_method --------- Co-authored-by: Oleg Klimov --- refact_scratchpads_no_gpu/stream_results.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/refact_scratchpads_no_gpu/stream_results.py b/refact_scratchpads_no_gpu/stream_results.py index 0d1d9b4f..87cd827e 100644 --- a/refact_scratchpads_no_gpu/stream_results.py +++ b/refact_scratchpads_no_gpu/stream_results.py @@ -142,13 +142,9 @@ def test_head_and_tail(): class UploadProxy: def __init__( self, - upload_q: Optional[multiprocessing.Queue], - cancelled_q: Optional[multiprocessing.Queue], + upload_q: Optional[multiprocessing.Queue] = None, + cancelled_q: Optional[multiprocessing.Queue] = None, ): - try: - multiprocessing.set_start_method("spawn") - except: # it could be already set - pass self.upload_q = upload_q or multiprocessing.Queue() self.cancelled_q = cancelled_q or multiprocessing.Queue() self.proc = None @@ -161,6 +157,7 @@ def start_upload_result_daemon(self): target=_upload_results_loop, args=(self.upload_q, self.cancelled_q), name="upload_results", + daemon=True ) self.proc.start() return self.proc