CreeperBeatz opened a new issue, #59707:
URL: https://github.com/apache/airflow/issues/59707

   ### Apache Airflow Provider(s)
   
   celery
   
   ### Versions of Apache Airflow Providers
   
   3.14.1
   
   ### Apache Airflow version
   
   3.1.5
   
   ### Operating System
   
   WSL Ubuntu 22.04
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   Installed with UV:
   
   ```
   uv pip install "apache-airflow[celery]==3.1.5" --constraint 
"https://raw.githubusercontent.com/apache/airflow/constraints-3.1.5/constraints-3.12.txt";
   ```
   
   ### What happened
   
   When starting a Celery worker with a custom --celery-hostname, the worker 
successfully connects to the broker and reserves tasks, but never executes them.
   
   The task stays in reserved state with:
   
   acknowledged: False
   worker_pid: None
   time_start: None
   
   Removing --celery-hostname and using the default hostname makes everything 
work correctly.
   
   #### Output when using `--celery-hostname`:
   
   ```
   (.venv) me@DESKTOP-MAG5124:~/airflow$ celery -A 
airflow.providers.celery.executors.celery_executor_utils.app inspect reserved
   ->  default@DESKTOP-MAG5124: OK
       * {'id': '923f016a-a3da-42c2-bf57-4f4193e11721', 'name': 
'execute_workload', 'args': 
['{"token":"eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIwMTliNDUyNi00MmY2LTdmNWQtYWQ1Zi1jNWY4MWRlMjAxNTEiLCJqdGkiOiJkOGUzZDdlODc5ZDE0OGE2YWNiZWQ5Y2ZmZmMwMjZmZSIsImF1ZCI6InVybjphaXJmbG93LmFwYWNoZS5vcmc6dGFzayIsIm5iZiI6MTc2NjM5MTY5NCwiZXhwIjoxNzY2MzkyMjk0LCJpYXQiOjE3NjYzOTE2OTR9.tGA_sdHlGhTf6UXHO8eX5a7IeJyHpVUnUKSKtXW-Lhl4J2Y9UQEg0j5az7SSSulzudcxjDqSCuXP9V2ksZyDeQ","ti":{"id":"019b4526-42f6-7f5d-ad5f-c5f81de20151","dag_version_id":"019b450d-b021-79cd-8374-49824e6cc8c5","task_id":"get_airflow_variables","dag_id":"dirbg_crawler","run_id":"manual__2025-12-22T07:57:45+00:00","try_number":2,"map_index":-1,"pool_slots":1,"queue":"default","priority_weight":2,"parent_context_carrier":{},"context_carrier":{}},"dag_rel_path":"dirbg_crawler.py","bundle_info":{"name":"dags-folder","version":null},"log_path":"dag_id=dirbg_crawler/run_id=manual__2025-12-22T07:57:45+00:00/task_id=get_airflow_variables/att
 empt=2.log","type":"ExecuteTask"}'], 'kwargs': {}, 'type': 'execute_workload', 
'hostname': 'default@DESKTOP-MAG5124', 'time_start': None, 'acknowledged': 
False, 'delivery_info': {'exchange': '', 'routing_key': 'default', 'priority': 
0, 'redelivered': False}, 'worker_pid': None}
   
   1 node online.
   ```
   
   ```
   (.venv) me@DESKTOP-MAG5124:~/airflow$ celery -A 
airflow.providers.celery.executors.celery_executor_utils.app inspect 
active_queues
   ->  default@DESKTOP-MAG5124: OK
       * {'name': 'default', 'exchange': {'name': 'default', 'type': 'direct', 
'arguments': None, 'durable': True, 'passive': False, 'auto_delete': False, 
'delivery_mode': None, 'no_declare': False}, 'routing_key': 'default', 
'queue_arguments': None, 'binding_arguments': None, 'consumer_arguments': None, 
'durable': True, 'exclusive': False, 'auto_delete': False, 'no_ack': False, 
'alias': None, 'bindings': [], 'no_declare': None, 'expires': None, 
'message_ttl': None, 'max_length': None, 'max_length_bytes': None, 
'max_priority': None}
   
   1 node online.
   ```
   
   #### Output when **NOT** using `--celery-hostname`:
   
   
   Note: The task is already executing.
   ```
   (.venv) dani@DESKTOP-MAG5124:~/airflow$ celery -A 
airflow.providers.celery.executors.celery_executor_utils.app inspect reserved
   ->  celery@DESKTOP-MAG5124: OK
       - empty -
   ```
   
   ### What you think should happen instead
   
   Worker should execute reserved tasks regardless of custom hostname.
   
   ### How to reproduce
   
   This does NOT work - task reserved but never executed
   ```
   airflow celery worker \
     --queues my_queue \
     --concurrency 1 \
     --celery-hostname "myworker@%h"
   ```
   This is valid even if you set the --celery-hostname to "celery@%h" which 
should be the default option.
   
   
   This WORKS
   ```
   airflow celery worker \
     --queues my_queue \
     --concurrency 1
   ```
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to