mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2025-10-26 17:21:58 -06:00
26 lines
794 B
Python
26 lines
794 B
Python
"""Borealis controller shims executed on interpreter startup."""
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
import multiprocessing
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
try:
|
|
multiprocessing.set_start_method('spawn')
|
|
except RuntimeError:
|
|
pass
|
|
|
|
try:
|
|
mp_ctx = multiprocessing.get_context('fork')
|
|
except ValueError:
|
|
try:
|
|
import ansible.utils.multiprocessing as ansible_mp # type: ignore
|
|
except Exception:
|
|
log.debug('Borealis sitecustomize: ansible multiprocessing module missing; skipping fork patch')
|
|
else:
|
|
ansible_mp.context = multiprocessing.get_context('spawn')
|
|
log.debug('Borealis sitecustomize: patched ansible multiprocessing context to spawn')
|
|
else:
|
|
log.debug('Borealis sitecustomize: fork context available (%s)', mp_ctx)
|