Commit Graph
12 Commits
Author SHA1 Message Date
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
Cédric Krier e15c0b7d7a Upgrade to pyproject using hatchling as build-system 2026-03-21 18:46:34 +01:00
Cédric Krier 815bd08c8e Auto reload the server when tryton.cfg files are modified
Since 6eb1a23b7457 the tryton.cfg files contains the model to register.
Therefore if they change, the server must be reloaded.
2025-12-03 12:10:53 +01:00
Cédric Krier 95dc47a24f Include the traceback only in RPC responses in development mode
Closes #14354
2025-11-12 14:56:34 +01:00
Cédric Krier 74ee169c54 Refactor of trytond.config to add cache
This removes the need to store configuration in global variable and so make it
easier to update for example for testing.

Closes #14249
2025-10-07 08:19:57 +02:00
Cédric Krier 339ee1867d Use process pool to run cron
Closes #13053
2024-04-03 16:28:22 +02:00
Cédric Krier 02bbbc6549 Silent exit of cron and worker with keyboard 2024-02-04 20:51:05 +01:00
Cédric Krier ec5a00c82e Make pool initialization atomic
An instance of pool is created per thread and it stores a reference to the
current pool values.
When the pool is initialized, a temporary reference is set on the instance so
only the values for this thread is modified. Once the initialization is
complete, the new pool value replace the global values.
Each instances is refreshed with the global values after the pool has been
stopped.

Closes #11401
2024-03-06 18:28:38 +01:00
Dani Möller aa96c33cbc Rewrite worker with concurrent.futures instead of multiprocessing
Unlike multiprocessing pools, the concurrent library pools will raise an
exception if child processes have died and can't accept further tasks. This
should cause the main worker to stop instead of stalling in an inifinite wait.

Introduce a dummy noop execution in the pool to probe if it is still operative
to mitigate the volume of lost tasks if the next submited execution would raise
a BrokenExecutor exception. This isn't 100% bulletproof because the pool might
still break between the probe and a new task being pulled.

The maxtasksperchild CLI option will only work for Python 3.11 onwards because
former concurrent.futures pools do not support this option.

Closes #11104
2024-02-04 20:32:09 +01:00
Nicolas Évrard 9ef3a0aafa Allow skipping index creation
Closes #12596
2023-09-27 17:15:44 +02:00
Cédric Krier 80e19a25eb Remove EGG_MODULES to rely only on imported module path 2023-10-12 01:30:18 +02:00
Cédric Krier cc8faa6699 Prepare migration to monorepo 2022-12-16 14:43:04 +01:00