Skip to content

Commit

Permalink
make it daemon, removed extra set_start_method
Browse files Browse the repository at this point in the history
  • Loading branch information
JegernOUTT committed Sep 8, 2023
1 parent 22e8f9f commit 6720e7c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions refact_scratchpads_no_gpu/stream_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 6720e7c

Please sign in to comment.