This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 0b84f7764ac Only send hostname to celery worker if passed in cli
(#55913)
0b84f7764ac is described below
commit 0b84f7764ac7cf831db3201ae2ccd9af71a248b5
Author: Jed Cunningham <[email protected]>
AuthorDate: Tue Sep 23 08:45:46 2025 -0600
Only send hostname to celery worker if passed in cli (#55913)
* Only send hostname to celery worker if passed in cli
We were setting the hostname in the celery worker, even if the user did
not specify one. This meant we were passing on None. Historically, that
has still resulted in the default value being used instead of None, but
that has changed in click 8.3.0 (which celery uses in its cli). Either
way, no need for us to pass it!
* Fix test
It'll actually run when #55915 is merged, but it will pass when it does
start running.
---
providers/celery/src/airflow/providers/celery/cli/celery_command.py | 4 ++--
providers/celery/tests/unit/celery/cli/test_celery_command.py | 5 +++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git
a/providers/celery/src/airflow/providers/celery/cli/celery_command.py
b/providers/celery/src/airflow/providers/celery/cli/celery_command.py
index 64379411767..3022e7b474b 100644
--- a/providers/celery/src/airflow/providers/celery/cli/celery_command.py
+++ b/providers/celery/src/airflow/providers/celery/cli/celery_command.py
@@ -239,11 +239,11 @@ def worker(args):
args.queues,
"--concurrency",
args.concurrency,
- "--hostname",
- args.celery_hostname,
"--loglevel",
celery_log_level,
]
+ if args.celery_hostname:
+ options.extend(["--hostname", args.celery_hostname])
if autoscale:
options.extend(["--autoscale", autoscale])
if args.without_mingle:
diff --git a/providers/celery/tests/unit/celery/cli/test_celery_command.py
b/providers/celery/tests/unit/celery/cli/test_celery_command.py
index 94e339804e3..f7f786733e5 100644
--- a/providers/celery/tests/unit/celery/cli/test_celery_command.py
+++ b/providers/celery/tests/unit/celery/cli/test_celery_command.py
@@ -131,6 +131,7 @@ class TestWorkerStart:
@classmethod
def setup_class(cls):
with conf_vars({("core", "executor"): "CeleryExecutor"}):
+ importlib.reload(executor_loader)
importlib.reload(cli_parser)
cls.parser = cli_parser.get_parser()
@@ -172,10 +173,10 @@ class TestWorkerStart:
queues,
"--concurrency",
int(concurrency),
- "--hostname",
- celery_hostname,
"--loglevel",
conf.get("logging", "CELERY_LOGGING_LEVEL"),
+ "--hostname",
+ celery_hostname,
"--autoscale",
autoscale,
"--without-mingle",