Skip to content

Commit

Permalink
Upload proxy as a daemon (#97)
Browse files Browse the repository at this point in the history
* make it daemon, removed extra set_start_method

---------

Co-authored-by: Oleg Klimov <omgtech@gmail.com>
  • Loading branch information
JegernOUTT and olegklimov authored Sep 13, 2023
1 parent 1f8b011 commit db9942c
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 db9942c

Please sign in to comment.