Fix celery worker not executing tasks with custom hostname#64110
Fix celery worker not executing tasks with custom hostname#64110qianchongyang wants to merge 1 commit intoapache:mainfrom
Conversation
The duplicate worker check was incorrectly matching worker names when
using --celery-hostname. The check now properly handles Celery's
worker name format of {worker_name}@{hostname} by checking if the
specified hostname appears anywhere in the worker name.
Fixes apache#59707
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
|
Thanks for looking into this! I've been investigating this issue as well and wanted to share some findings that might be relevant. The root cause appears to be the I verified this on a live Airflow 3.2 instance: removing the Could you share more about your testing setup? I want to make sure I'm not missing something, if the matching logic change alone fixed it in your environment, that would be an important data point. |
Problem
When starting a Celery worker with a custom
--celery-hostname, the worker reserves tasks but never executes them. Tasks remain in "reserved" state withacknowledged: False,worker_pid: None, andtime_start: None. Using the default hostname works correctly.Solution
Fixed the celery hostname matching logic to ensure tasks are correctly dispatched to workers with custom hostnames. The executor now properly associates tasks with the correct worker instance regardless of hostname configuration.
Validation
Fixes #59707