Skip to content

Commit

Permalink
Unconditionally set mp_context for ProcessPoolExecutor
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed Nov 19, 2024
1 parent 798c6b1 commit f791e3d
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions apscheduler/executors/pool.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import concurrent.futures
import sys
import multiprocessing
from abc import abstractmethod
from concurrent.futures.process import BrokenProcessPool

Expand Down Expand Up @@ -73,12 +73,6 @@ class ProcessPoolExecutor(BasePoolExecutor):

def __init__(self, max_workers=10, pool_kwargs=None):
pool_kwargs = pool_kwargs or {}

# On Python 3.14, "spawn" is the default mp_context
if sys.version_info < (3, 14):
import multiprocessing

pool_kwargs.setdefault("mp_context", multiprocessing.get_context("spawn"))

pool_kwargs.setdefault("mp_context", multiprocessing.get_context("spawn"))
pool = concurrent.futures.ProcessPoolExecutor(int(max_workers), **pool_kwargs)
super().__init__(pool)

0 comments on commit f791e3d

Please sign in to comment.