Skip to content

Commit

Permalink
feat: allow to pass extra parameters for celery workers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Sep 12, 2024
1 parent f94a92c commit 27dda21
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions tutorcelery/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class CELERY_WORKERS_ATTRS_TYPE(TypedDict):
max_replicas: NotRequired[int]
list_length: NotRequired[int]
enable_keda: bool
extra_params: NotRequired[dict[str, str]]


CELERY_WORKERS_CONFIG: Filter[dict[str, dict[str, CELERY_WORKERS_ATTRS_TYPE]], []] = (
Expand Down
3 changes: 3 additions & 0 deletions tutorcelery/patches/k8s-deployments
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ spec:
- "--hostname=edx.{{service}}.core.{{variant}}.%%h"
- "--max-tasks-per-child=100"
- "--queues=edx.{{service}}.core.{{variant}}"
{% for setting, value in config.get("extra_params", {}).items() %}
- "--{{setting}}={{value}}"
{% endfor %}
env:
- name: SERVICE_VARIANT
value: {{service}}
Expand Down
5 changes: 4 additions & 1 deletion tutorcelery/patches/k8s-override
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@ spec:
- "--queues=edx.{{service}}.core.default"
{% else -%}
- "--exclude-queues=edx.{{exclude}}.core.default"
{% endif -%}
{% endif %}
{% for setting, value in config.get("extra_params", {}).items() %}
- "--{{setting}}={{value}}"
{% endfor %}
{% endfor %}

0 comments on commit 27dda21

Please sign in to comment.