From 54aeb80ef143d3e8334058aede1eea4f85117745 Mon Sep 17 00:00:00 2001 From: Niko Oliveira Date: Sat, 14 Feb 2026 11:51:06 -0800 Subject: [PATCH] Insert a team_name similar to team conf for 2.X compat A None team name is added if we are running against an older Airflow version. Also don't use a team conf at all if the version isn't at least 3.2 (this is when airflow supports even a minimal version of multi-team) --- .../src/airflow/providers/celery/executors/celery_executor.py | 4 ++++ .../providers/celery/executors/celery_executor_utils.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/providers/celery/src/airflow/providers/celery/executors/celery_executor.py b/providers/celery/src/airflow/providers/celery/executors/celery_executor.py index 8a0d93ef9c12c..abb3b860059a3 100644 --- a/providers/celery/src/airflow/providers/celery/executors/celery_executor.py +++ b/providers/celery/src/airflow/providers/celery/executors/celery_executor.py @@ -114,6 +114,10 @@ def __init__(self, *args, **kwargs): from airflow.configuration import conf as global_conf self.conf = global_conf + # Also set team_name to None if it doesn't exist, since the Celery app creation expects it to be + # there (even if it's None) + if not hasattr(self, "team_name"): + self.team_name = None # Create Celery app, it will be team specific if the configuration has been set for that. from airflow.providers.celery.executors.celery_executor_utils import create_celery_app diff --git a/providers/celery/src/airflow/providers/celery/executors/celery_executor_utils.py b/providers/celery/src/airflow/providers/celery/executors/celery_executor_utils.py index 14c2c2abb395d..b09737701f3f7 100644 --- a/providers/celery/src/airflow/providers/celery/executors/celery_executor_utils.py +++ b/providers/celery/src/airflow/providers/celery/executors/celery_executor_utils.py @@ -42,7 +42,7 @@ from airflow.configuration import AirflowConfigParser, conf from airflow.executors.base_executor import BaseExecutor -from airflow.providers.celery.version_compat import AIRFLOW_V_3_0_PLUS +from airflow.providers.celery.version_compat import AIRFLOW_V_3_0_PLUS, AIRFLOW_V_3_2_PLUS from airflow.providers.common.compat.sdk import AirflowException, AirflowTaskTimeout, Stats, timeout from airflow.utils.log.logging_mixin import LoggingMixin from airflow.utils.net import get_hostname @@ -319,7 +319,7 @@ def send_task_to_executor( if TYPE_CHECKING: _conf: ExecutorConf | AirflowConfigParser # Check if Airflow version is greater than or equal to 3.2 to import ExecutorConf - if AIRFLOW_V_3_0_PLUS: + if AIRFLOW_V_3_2_PLUS: from airflow.executors.base_executor import ExecutorConf _conf = ExecutorConf(team_name)