dheerajturaga commented on code in PR #60675:
URL: https://github.com/apache/airflow/pull/60675#discussion_r2724383833
##########
providers/celery/src/airflow/providers/celery/cli/celery_command.py:
##########
@@ -189,8 +189,27 @@ def filter(self, record):
@_providers_configuration_loaded
def worker(args):
"""Start Airflow Celery worker."""
- # This needs to be imported locally to not trigger Providers Manager
initialization
- from airflow.providers.celery.executors.celery_executor import app as
celery_app
+ team_config = None
+ if hasattr(args, "team") and args.team:
+ # Multi-team is enabled, create team-specific Celery app and use team
based config
+ try:
+ from airflow.executors.base_executor import ExecutorConf
+ except ImportError:
+ raise SystemExit(
+ f"Error: Multi-team support (--team {args.team}) requires
Airflow >=3.2. "
+ "Please upgrade Airflow or remove the --team parameter."
+ )
Review Comment:
Add attribute check before creating the ExecutorConf object?
```suggestion
)
# Check if ExecutorConf has required methods for multi-team support
if not (hasattr(ExecutorConf, 'has_option') and
hasattr(ExecutorConf, 'getsection')):
raise SystemExit(
f"Error: Multi-team support (--team {args.team}) requires
Airflow >=3.2. "
"Please upgrade Airflow or remove the --team parameter."
)
```
##########
providers/celery/src/airflow/providers/celery/cli/celery_command.py:
##########
@@ -218,8 +237,8 @@ def worker(args):
autoscale = args.autoscale
skip_serve_logs = args.skip_serve_logs
- if autoscale is None and conf.has_option("celery", "worker_autoscale"):
- autoscale = conf.get("celery", "worker_autoscale")
+ if autoscale is None and config.has_option("celery", "worker_autoscale"):
Review Comment:
@o-nikolas, this is failing backward compatibility. In Airflow 3.1.3,
ExecutorConf exists but lacks critical methods like has_option, getsection,
etc. were added in commit 5ba75af409 for Airflow 3.2+
```
if autoscale is None and config.has_option("celery", "worker_autoscale"):
AttributeError: 'ExecutorConf' object has no attribute 'has_option'
```
--
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]