|
| 1 | +# Celery plugin for [Tutor](https://docs.tutor.edly.io) |
| 2 | + |
| 3 | +A tutor plugin to extend the default LMS and CMS celery workers included in Tutor. |
| 4 | +It adds and configures extra deployments running LMS and CMS celery workers where |
| 5 | +every deployment will process async tasks routed to a specific queue. Having this |
| 6 | +workers separation per queue can help to define the scaling requirements for the Celery |
| 7 | +deployments, since having a single queue (the default one) with a single deployment can |
| 8 | +lead to unexpected behaviors when running large-scale sites. |
| 9 | + |
| 10 | +## Installation |
| 11 | + |
| 12 | +```shell |
| 13 | +pip install git+https://github.com/eduNEXT/tutor-contrib-celery |
| 14 | +``` |
| 15 | + |
| 16 | +## Usage |
| 17 | + |
| 18 | +```shell |
| 19 | +tutor plugins enable celery |
| 20 | +``` |
| 21 | + |
| 22 | +## Configuration |
| 23 | + |
| 24 | +### Celery queues |
| 25 | + |
| 26 | +By default, tutor-contrib-celery enables the following queues with independent deployments |
| 27 | +for each: |
| 28 | + |
| 29 | +- **CMS**: default, high, low (taken from CMS settings [here](https://github.com/openedx/edx-platform/blob/open-release/redwood.master/cms/envs/common.py#L1578-L1582)) |
| 30 | +- **LMS**: default, high, high_mem (taken from LMS settings [here](https://github.com/openedx/edx-platform/blob/open-release/redwood.master/lms/envs/common.py#L2913-L2917)) |
| 31 | + |
| 32 | +> [!NOTE] |
| 33 | +> We recommend using [tutor-contrib-pod-autoscaling](https://github.com/eduNEXT/tutor-contrib-pod-autoscaling) |
| 34 | +> to setup requested resources and limits. |
| 35 | +
|
| 36 | +In case you are using different celery queues than the defaults from Open edX, you can |
| 37 | +extend the list by setting `CELERY_WORKER_VARIANTS` on your `config.yml`. The format is the following: |
| 38 | + |
| 39 | +```yaml |
| 40 | +CELERY_WORKER_VARIANTS: |
| 41 | + lms: |
| 42 | + - high |
| 43 | + - high_mem |
| 44 | + - lms_custom_queue |
| 45 | + cms: |
| 46 | + - high |
| 47 | + - low |
| 48 | + - cms_custom_queue |
| 49 | +``` |
| 50 | +
|
| 51 | +This plugin also provides a setting to directly route LMS/CMS tasks to an specific queue. It can extends/overrides |
| 52 | +the default `EXPLICIT_QUEUES` setting: |
| 53 | + |
| 54 | +```yaml |
| 55 | +CELERY_LMS_EXPLICIT_QUEUES: |
| 56 | + lms.djangoapps.grades.tasks.compute_all_grades_for_course: |
| 57 | + queue: edx.lms.core.high_mem |
| 58 | +CELERY_CMS_EXPLICIT_QUEUES: |
| 59 | + cms.djangoapps.contentstore.tasks.import_olx: |
| 60 | + queue: edx.cms.core.high |
| 61 | +``` |
| 62 | + |
| 63 | +License |
| 64 | +******* |
| 65 | + |
| 66 | +This software is licensed under the terms of the AGPLv3. |
0 commit comments