Files
Cédric Krier 4fca529235 Support pool process with spawn context for cron and worker
When max_tasks_per_child is set, the ProcessPoolExecutor uses a spawn
multiprocessing context which starts a new process from scratch with a __name__
being __mp_main__ which prevents the configuration to be restored.
So in the ProcessPoolExecutor initializer the configuration is restored using
the initial options.

Closes #14843
(grafted from cb5c6667ac51818d49ca397347419a40b88768fd)

--HG--
branch : 8.0
2026-05-19 12:29:44 +02:00

18 lines
527 B
Python
Executable File

#!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import os
import sys
DIR = os.path.abspath(os.path.normpath(os.path.join(__file__,
'..', '..', 'trytond')))
if os.path.isdir(DIR):
sys.path.insert(0, os.path.dirname(DIR))
from trytond.cli.worker import main # noqa: E402
# Ensure main module can be safely imported by a new interpreter
if __name__ == '__main__':
main()