File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change
1
+ import multiprocessing as mp
1
2
import os
2
3
import random
3
4
import shutil
4
- from multiprocessing import Process
5
5
from typing import Dict , Optional , Type , Union
6
6
7
7
import fsspec
@@ -403,7 +403,15 @@ def create_job(self, model: CreateJob) -> str:
403
403
staging_paths = self .get_staging_paths (DescribeJob .from_orm (job ))
404
404
self .copy_input_file (model .input_uri , staging_paths ["input" ])
405
405
406
- p = Process (
406
+ # The MP context forces new processes to not be forked on Linux.
407
+ # This is necessary because `asyncio.get_event_loop()` is bugged in
408
+ # forked processes in Python versions below 3.12. This method is
409
+ # called by `jupyter_core` by `nbconvert` in the default executor.
410
+ #
411
+ # See: https://github.com/python/cpython/issues/66285
412
+ # See also: https://github.com/jupyter/jupyter_core/pull/362
413
+ mp_ctx = mp .get_context ("spawn" )
414
+ p = mp_ctx .Process (
407
415
target = self .execution_manager_class (
408
416
job_id = job .job_id ,
409
417
staging_paths = staging_paths ,
You can’t perform that action at this time.
0 commit comments