-
Notifications
You must be signed in to change notification settings - Fork 16.6k
Fix KEDA Query to Use executor Field Instead of queue for Multiple Executors#52840
Fix KEDA Query to Use executor Field Instead of queue for Multiple Executors#52840romsharon98 merged 2 commits intoapache:mainfrom
Conversation
Description:
When multiple executors (e.g., CeleryExecutor,KubernetesExecutor) are configured, the worker default KEDA query uses the queue column in the Airflow metadata database to determine Celery worker scaling.
However, task routing in Airflow is based on the executor attribute, not queue. This causes Celery workers to scale up unnecessarily for tasks explicitly configured with executor='KubernetesExecutor' but using the default queue
Changes:
This PR updates the KEDA query logic in values.yaml to correctly filter tasks based on the executor field when multiple executors are configured:
- For
CeleryKubernetesExecutor, the existing logic is retained, usingqueue != '{{ .Values.config.celery_kubernetes_executor.kubernetes_queue }}'. - For configurations including
KubernetesExecutor(alone or withCeleryExecutor), the query is updated to useexecutor != 'KubernetesExecutor'ensuring tasks assigned toKubernetesExecutornot trigger Celery worker scaling.
Testing Steps
- Deploy Airflow using Helm Chart with
KEDAenabled and multiple executors:
executor: CeleryExecutor,KubernetesExecutor
workers:
keda:
enabled: true
- Create a DAG with tasks explicitly using
KubernetesExecutorandqueue='default' - Verify that Celery workers do not scale up for tasks with
executor='KubernetesExecutor'
Additional Notes:
Related Issues:
Closes: #49001
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.
|
Tests need to be fixed |
jason810496
left a comment
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.
Nice catch!
bugraoz93
left a comment
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.
Thanks for the changes! Could you please rebase it before merging it? The PR has 137 commits
|
I think you are merging the changes. You need to rebase from master and force push changes to your branch. |
separately from CeleryKubernetesExecutor, ensuring tasks with KubernetesExecutor
are filtered by executor type instead of queue name.
- Updated the corresponding logic in test_keda.py to reflect the new query structure,
improving test accuracy for KubernetesExecutor scenarios.
b749ba9 to
15b0e67
Compare
|
I think I changed it correctly this time! Thanks a lot for the help! |
|
This is it, thanks! :) |
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |