diff --git a/tutorcelery/patches/k8s-deployments b/tutorcelery/patches/k8s-deployments index aa12db1..65a0615 100644 --- a/tutorcelery/patches/k8s-deployments +++ b/tutorcelery/patches/k8s-deployments @@ -1,3 +1,4 @@ +{% if CELERY_MULTIQUEUE_ENABLED %} {% for service, variants in CELERY_WORKER_VARIANTS.items() %} {% for variant in variants%} {% set deployment = service + "-" + "worker" + "-" + variant.replace("_", "-") %} @@ -52,7 +53,7 @@ spec: name: openedx-config {% endfor %} {% endfor %} - +{% endif %} {% if CELERY_FLOWER -%} --- apiVersion: apps/v1 diff --git a/tutorcelery/patches/k8s-override b/tutorcelery/patches/k8s-override index 999dfe0..fbb8362 100644 --- a/tutorcelery/patches/k8s-override +++ b/tutorcelery/patches/k8s-override @@ -1,3 +1,4 @@ +{% if CELERY_MULTIQUEUE_ENABLED %} {% for service in ["lms", "cms"] %} --- apiVersion: apps/v1 @@ -18,3 +19,4 @@ spec: - "--max-tasks-per-child=100" - "--queues=edx.{{service}}.core.default" {% endfor %} +{% endif %} diff --git a/tutorcelery/patches/openedx-cms-production-settings b/tutorcelery/patches/openedx-cms-production-settings index 38c4c00..7959174 100644 --- a/tutorcelery/patches/openedx-cms-production-settings +++ b/tutorcelery/patches/openedx-cms-production-settings @@ -1,7 +1,8 @@ +{% if CELERY_MULTIQUEUE_ENABLED %} try: EXPLICIT_QUEUES.update({{CELERY_CMS_EXPLICIT_QUEUES}}) except NameError: EXPLICIT_QUEUES = {{CELERY_CMS_EXPLICIT_QUEUES}} - +{% endif %} # Prevents losing tasks when workers are shutdown CELERY_ACKS_LATE = True diff --git a/tutorcelery/patches/openedx-lms-production-settings b/tutorcelery/patches/openedx-lms-production-settings index 3ccc767..4b7f3e2 100644 --- a/tutorcelery/patches/openedx-lms-production-settings +++ b/tutorcelery/patches/openedx-lms-production-settings @@ -1,7 +1,9 @@ +{% if CELERY_MULTIQUEUE_ENABLED %} try: EXPLICIT_QUEUES.update({{CELERY_LMS_EXPLICIT_QUEUES}}) except NameError: EXPLICIT_QUEUES = {{CELERY_LMS_EXPLICIT_QUEUES}} +{% endif %} # Prevents losing tasks when workers are shutdown CELERY_ACKS_LATE = True diff --git a/tutorcelery/plugin.py b/tutorcelery/plugin.py index c12e63e..1813c20 100644 --- a/tutorcelery/plugin.py +++ b/tutorcelery/plugin.py @@ -28,6 +28,7 @@ ("CELERY_FLOWER", False), ("CELERY_FLOWER_HOST", "flower.{{LMS_HOST}}"), ("CELERY_FLOWER_DOCKER_IMAGE", "docker.io/mher/flower:2.0.1"), + ("CELERY_MULTIQUEUE_ENABLED", False), ] )