-
Couldn't load subscription status.
- Fork 32
🐛 Use Celery prefork pool for CPU-bound tasks
#8500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Use Celery prefork pool for CPU-bound tasks
#8500
Conversation
…k-pool-for-cpu-bound-celery-tasks
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #8500 +/- ##
==========================================
+ Coverage 87.44% 87.53% +0.09%
==========================================
Files 1959 2008 +49
Lines 76525 78421 +1896
Branches 1343 1344 +1
==========================================
+ Hits 66916 68645 +1729
- Misses 9207 9374 +167
Partials 402 402
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
🧪 CI InsightsHere's what we observed from your CI run for 436e6dc. ✅ Passed Jobs With Interesting Signals
|
…github.com:giancarloromeo/osparc-simcore into is8496/use-prefork-pool-for-cpu-bound-celery-tasks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the Celery worker configuration to use the prefork execution pool for CPU-bound tasks instead of the previous threads pool. The changes improve performance for CPU-intensive tasks by leveraging separate processes rather than threads, which is better suited for Python's GIL limitations.
Key changes:
- Restructured worker module organization to support both thread and prefork pools
- Added configurable
CELERY_POOLenvironment variable withpreforkas default - Updated worker initialization to handle process-based workers properly
Reviewed Changes
Copilot reviewed 15 out of 19 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| services/storage/src/simcore_service_storage/modules/celery/worker_main.py | Removed old worker main file |
| services/storage/src/simcore_service_storage/modules/celery/worker/main.py | New worker main with process-aware initialization |
| services/storage/docker/boot.sh | Updated to use new worker module and configurable pool |
| services/docker-compose.yml | Added CELERY_POOL environment variables for different services |
| services/api-server/ | Multiple files updated for module reorganization and import path fixes |
| packages/settings-library/src/settings_library/celery.py | Added CELERY_POOL setting with validation |
| packages/celery-library/src/celery_library/signals.py | Simplified signal handlers for process-based workers |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
services/storage/src/simcore_service_storage/modules/celery/worker/main.py
Outdated
Show resolved
Hide resolved
services/api-server/src/simcore_service_api_server/modules/celery/worker/main.py
Outdated
Show resolved
Hide resolved
…github.com:giancarloromeo/osparc-simcore into is8496/use-prefork-pool-for-cpu-bound-celery-tasks
…k-pool-for-cpu-bound-celery-tasks
…github.com:giancarloromeo/osparc-simcore into is8496/use-prefork-pool-for-cpu-bound-celery-tasks
…k-pool-for-cpu-bound-celery-tasks
|
@Mergifyio queue |
🟠 Waiting for conditions to match
|
|
0c9e189
into
ITISFoundation:master



What do these changes do?
This PR updates the Celery worker configuration to use the
preforkexecution pool for CPU-bound tasks instead of the previousthreadspool. The changes improve performance for CPU-intensive tasks by leveraging separate processes rather than threads, which is better suited for Python's GIL limitations.For CPU-bound (
preforked workers), all Celery internal heartbeat mechanisms are now executed in theMainProcesswhile the tasks run in independentForkPoolWorkers.Key changes:
CELERY_POOLenvironment variable withpreforkas defaultRelated issue/s
How to test
Dev-ops