This is an automated email from the ASF dual-hosted git repository.

dheerajturaga 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 80090d2ddfe Fix mismatched AirflowConfigException in celery and edge3 
(#72437)
80090d2ddfe is described below

commit 80090d2ddfee39e773b2758c80bf63648b5b3346
Author: PoAn Yang <[email protected]>
AuthorDate: Sun Sep 6 12:43:59 2026 +0900

    Fix mismatched AirflowConfigException in celery and edge3 (#72437)
    
    Signed-off-by: PoAn Yang <[email protected]>
---
 .../airflow/providers/celery/cli/celery_command.py    |  3 +--
 .../providers/celery/executors/default_celery.py      |  8 +++++---
 .../tests/unit/celery/cli/test_celery_command.py      |  9 +++++++++
 .../unit/celery/executors/test_celery_executor.py     | 19 +++++++++++++++++++
 .../providers/edge3/plugins/edge_executor_plugin.py   |  3 +--
 .../unit/edge3/plugins/test_edge_executor_plugin.py   |  7 +++++++
 6 files changed, 42 insertions(+), 7 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 3a953f2a26b..830c5d42cc8 100644
--- a/providers/celery/src/airflow/providers/celery/cli/celery_command.py
+++ b/providers/celery/src/airflow/providers/celery/cli/celery_command.py
@@ -36,14 +36,13 @@ from lockfile.pidlockfile import read_pid_from_pidfile, 
remove_existing_pidfile
 
 from airflow import settings
 from airflow.cli.simple_table import AirflowConsole
-from airflow.exceptions import AirflowConfigException
 from airflow.providers.celery.version_compat import (
     AIRFLOW_V_3_0_PLUS,
     AIRFLOW_V_3_1_PLUS,
     AIRFLOW_V_3_2_PLUS,
     AIRFLOW_V_3_3_PLUS,
 )
-from airflow.providers.common.compat.sdk import conf
+from airflow.providers.common.compat.sdk import AirflowConfigException, conf
 from airflow.utils import cli as cli_utils
 from airflow.utils.cli import setup_locations
 
diff --git 
a/providers/celery/src/airflow/providers/celery/executors/default_celery.py 
b/providers/celery/src/airflow/providers/celery/executors/default_celery.py
index c5cd8773d5f..8cc8a0ca445 100644
--- a/providers/celery/src/airflow/providers/celery/executors/default_celery.py
+++ b/providers/celery/src/airflow/providers/celery/executors/default_celery.py
@@ -25,9 +25,9 @@ import re
 import ssl
 from typing import TYPE_CHECKING
 
-from airflow.exceptions import AirflowConfigException
+from airflow.exceptions import AirflowConfigException as 
CoreAirflowConfigException
 from airflow.providers.celery.version_compat import AIRFLOW_V_3_0_PLUS
-from airflow.providers.common.compat.sdk import AirflowException, conf
+from airflow.providers.common.compat.sdk import AirflowConfigException, 
AirflowException, conf
 
 if TYPE_CHECKING:
     from typing import Any
@@ -195,7 +195,9 @@ def get_default_celery_config(team_conf: 
AirflowSDKConfigParser | Any) -> dict[s
     # Handle SSL configuration
     try:
         celery_ssl_active = team_conf.getboolean("celery", "SSL_ACTIVE", 
fallback=False)
-    except AirflowConfigException:
+    # ``team_conf`` is the Task SDK parser at module scope and core's 
``ExecutorConf`` on the
+    # multi-team path. Their ``AirflowConfigException`` classes share a name 
but are not the same class.
+    except (AirflowConfigException, CoreAirflowConfigException):
         log.warning("Celery Executor will run without SSL")
         celery_ssl_active = False
 
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 8a91aac7efc..9b9f4bcd7fd 100644
--- a/providers/celery/tests/unit/celery/cli/test_celery_command.py
+++ b/providers/celery/tests/unit/celery/cli/test_celery_command.py
@@ -799,6 +799,15 @@ def test_stale_bundle_cleanup(mock_process):
     assert actual[0] is _bundle_cleanup_main
 
 
+@patch("airflow.providers.celery.cli.celery_command.Process")
[email protected](not AIRFLOW_V_3_0_PLUS, reason="Doesn't apply to pre-3.0")
+@conf_vars({("dag_processor", "stale_bundle_cleanup_interval"): "not-an-int"})
+def test_stale_bundle_cleanup_skipped_on_non_integer_interval(mock_process):
+    with _run_stale_bundle_cleanup():
+        ...
+    mock_process.assert_not_called()
+
+
 @pytest.mark.skipif(not AIRFLOW_V_3_0_PLUS, reason="Doesn't apply to pre-3.0")
 def test_bundle_cleanup_main_is_picklable():
     """Regression test: _bundle_cleanup_main must be a module-level function 
so it can be
diff --git 
a/providers/celery/tests/unit/celery/executors/test_celery_executor.py 
b/providers/celery/tests/unit/celery/executors/test_celery_executor.py
index 62c74c56ef6..c4641ae2493 100644
--- a/providers/celery/tests/unit/celery/executors/test_celery_executor.py
+++ b/providers/celery/tests/unit/celery/executors/test_celery_executor.py
@@ -1571,6 +1571,25 @@ class TestAmqpsSslConfig:
         assert "certfile" not in broker_ssl
 
 
[email protected](
+    "get_team_conf",
+    [
+        pytest.param(lambda: conf, id="sdk_conf"),
+        pytest.param(
+            lambda: ExecutorConf(team_name=None),
+            id="executor_conf",
+            marks=pytest.mark.skipif(not AIRFLOW_V_3_2_PLUS, 
reason="ExecutorConf requires Airflow 3.2+"),
+        ),
+    ],
+)
+@conf_vars({("celery", "SSL_ACTIVE"): "yes"})
+def test_non_boolean_ssl_active_degrades_to_no_ssl(get_team_conf):
+    """A malformed [celery] ssl_active must degrade to a no-SSL config instead 
of raising."""
+    config = default_celery.get_default_celery_config(get_team_conf())
+
+    assert "broker_use_ssl" not in config
+
+
 class TestCreateCeleryAppTeamIsolation:
     """Tests for create_celery_app() multi-team config isolation."""
 
diff --git 
a/providers/edge3/src/airflow/providers/edge3/plugins/edge_executor_plugin.py 
b/providers/edge3/src/airflow/providers/edge3/plugins/edge_executor_plugin.py
index f18b438fa65..0d2af696ebd 100644
--- 
a/providers/edge3/src/airflow/providers/edge3/plugins/edge_executor_plugin.py
+++ 
b/providers/edge3/src/airflow/providers/edge3/plugins/edge_executor_plugin.py
@@ -20,8 +20,7 @@ from __future__ import annotations
 import sys
 from typing import TYPE_CHECKING, Any
 
-from airflow.exceptions import AirflowConfigException
-from airflow.providers.common.compat.sdk import AirflowPlugin, conf
+from airflow.providers.common.compat.sdk import AirflowConfigException, 
AirflowPlugin, conf
 from airflow.providers.edge3.version_compat import AIRFLOW_V_3_1_PLUS
 from airflow.utils.session import NEW_SESSION, provide_session
 
diff --git 
a/providers/edge3/tests/unit/edge3/plugins/test_edge_executor_plugin.py 
b/providers/edge3/tests/unit/edge3/plugins/test_edge_executor_plugin.py
index 2f06bb9c2d5..b374fc89f72 100644
--- a/providers/edge3/tests/unit/edge3/plugins/test_edge_executor_plugin.py
+++ b/providers/edge3/tests/unit/edge3/plugins/test_edge_executor_plugin.py
@@ -43,6 +43,13 @@ def test_plugin_inactive():
         assert len(rep.appbuilder_views) == 0
 
 
+def test_plugin_inactive_on_non_boolean_api_enabled():
+    with conf_vars({("edge", "api_enabled"): "yes"}):
+        importlib.reload(edge_executor_plugin)
+
+        assert edge_executor_plugin.EDGE_EXECUTOR_ACTIVE is False
+
+
 @pytest.mark.db_test
 def test_plugin_active_apiserver():
     mock_cli = ["airflow", "api-server"]

Reply via email to