@@ -472,15 +472,15 @@ def execute(self, progress=True, parallel=None, total=None):
472472
473473 # Don't fork, spawn entirely new processes. This
474474 # avoids accidental deadlocks.
475- mp .set_start_method ("spawn" , force = True )
475+ spawn_ctx = mp .get_context ("spawn" )
476476
477477 with tqdm (total = total , desc = "Tasks" , disable = (not progress )) as pbar :
478478 if self .parallel == 1 :
479479 while self .queue :
480480 _task_execute (self .queue .pop (0 ))
481481 pbar .update ()
482482 else :
483- with pathos .pools .ProcessPool (self .parallel ) as executor :
483+ with pathos .pools .ProcessPool (self .parallel , context = spawn_ctx ) as executor :
484484 for _ in executor .imap (_task_execute , self .queue ):
485485 pbar .update ()
486486
@@ -567,12 +567,12 @@ def capturing_soloprocess_upload(*args, **kwargs):
567567
568568 # Don't fork, spawn entirely new processes. This
569569 # avoids accidental deadlocks.
570- mp .set_start_method ("spawn" , force = True )
571- error_queue = mp .Manager ().Queue ()
570+ spawn_ctx = mp .get_context ("spawn" )
571+ error_queue = spawn_ctx .Manager ().Queue ()
572572
573573 ct = 0
574574 with tqdm (desc = "Upload" , total = total ) as pbar :
575- with pathos .pools .ProcessPool (parallel ) as pool :
575+ with pathos .pools .ProcessPool (parallel , context = spawn_ctx ) as pool :
576576 for num_inserted in pool .imap (uploadfn , sip (tasks , block_size )):
577577 pbar .update (num_inserted )
578578 ct += num_inserted
0 commit comments