This is an automated email from the ASF dual-hosted git repository.
potiuk 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 1d6bd9d8add Add dag bundles to `airflow info` command (#59124)
1d6bd9d8add is described below
commit 1d6bd9d8add268ae6d666975811ccfa6b599645b
Author: Jed Cunningham <[email protected]>
AuthorDate: Sat Dec 6 02:10:47 2025 -0700
Add dag bundles to `airflow info` command (#59124)
* Add dag bundles to `airflow info` command
Instead of showing the Airflow dags folder, which may not even be in
use any more, we now show all of the dag bundle names in the output of
`airflow info`.
* fix test
---
airflow-core/src/airflow/cli/commands/info_command.py | 7 +++----
airflow-core/src/airflow/dag_processing/bundles/manager.py | 8 ++++++++
airflow-core/tests/unit/cli/commands/test_info_command.py | 2 +-
.../tests/unit/dag_processing/bundles/test_dag_bundle_manager.py | 4 ++++
4 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/airflow-core/src/airflow/cli/commands/info_command.py
b/airflow-core/src/airflow/cli/commands/info_command.py
index 96b6550e482..06c32e5c0af 100644
--- a/airflow-core/src/airflow/cli/commands/info_command.py
+++ b/airflow-core/src/airflow/cli/commands/info_command.py
@@ -33,6 +33,7 @@ import tenacity
from airflow import configuration
from airflow.cli.simple_table import AirflowConsole
+from airflow.dag_processing.bundles.manager import DagBundlesManager
from airflow.providers_manager import ProvidersManager
from airflow.utils.cli import suppress_logs_and_warning
from airflow.utils.platform import getuser
@@ -229,9 +230,7 @@ class AirflowInfo:
sql_alchemy_conn = self.anonymizer.process_url(
configuration.conf.get("database", "SQL_ALCHEMY_CONN",
fallback="NOT AVAILABLE")
)
- dags_folder = self.anonymizer.process_path(
- configuration.conf.get("core", "dags_folder", fallback="NOT
AVAILABLE")
- )
+ bundle_names = DagBundlesManager().get_all_bundle_names()
plugins_folder = self.anonymizer.process_path(
configuration.conf.get("core", "plugins_folder", fallback="NOT
AVAILABLE")
)
@@ -247,7 +246,7 @@ class AirflowInfo:
("executor", executor),
("task_logging_handler", self._task_logging_handler()),
("sql_alchemy_conn", sql_alchemy_conn),
- ("dags_folder", dags_folder),
+ ("dag_bundle_names", bundle_names),
("plugins_folder", plugins_folder),
("base_log_folder", base_log_folder),
("remote_base_log_folder", remote_base_log_folder),
diff --git a/airflow-core/src/airflow/dag_processing/bundles/manager.py
b/airflow-core/src/airflow/dag_processing/bundles/manager.py
index b3d893e0c23..d7ff61f5802 100644
--- a/airflow-core/src/airflow/dag_processing/bundles/manager.py
+++ b/airflow-core/src/airflow/dag_processing/bundles/manager.py
@@ -341,6 +341,14 @@ class DagBundlesManager(LoggingMixin):
for name, cfg in self._bundle_config.items():
yield cfg.bundle_class(name=name, version=None, **cfg.kwargs)
+ def get_all_bundle_names(self) -> Iterable[str]:
+ """
+ Get all bundle names.
+
+ :return: sorted list of bundle names.
+ """
+ return sorted(self._bundle_config.keys())
+
def view_url(self, name: str, version: str | None = None) -> str | None:
warnings.warn(
"The 'view_url' method is deprecated and will be removed when
providers "
diff --git a/airflow-core/tests/unit/cli/commands/test_info_command.py
b/airflow-core/tests/unit/cli/commands/test_info_command.py
index 984251680d8..78b5e2b948f 100644
--- a/airflow-core/tests/unit/cli/commands/test_info_command.py
+++ b/airflow-core/tests/unit/cli/commands/test_info_command.py
@@ -113,7 +113,7 @@ class TestAirflowInfo:
"plugins_folder",
"base_log_folder",
"remote_base_log_folder",
- "dags_folder",
+ "dag_bundle_names",
"sql_alchemy_conn",
}
assert self.unique_items(instance._airflow_info) == expected
diff --git
a/airflow-core/tests/unit/dag_processing/bundles/test_dag_bundle_manager.py
b/airflow-core/tests/unit/dag_processing/bundles/test_dag_bundle_manager.py
index 888b85cd30c..79357e3264f 100644
--- a/airflow-core/tests/unit/dag_processing/bundles/test_dag_bundle_manager.py
+++ b/airflow-core/tests/unit/dag_processing/bundles/test_dag_bundle_manager.py
@@ -393,3 +393,7 @@ def test_example_dags_name_is_reserved():
with conf_vars({("dag_processor", "dag_bundle_config_list"):
json.dumps(reserved_name_config)}):
with pytest.raises(AirflowConfigException, match="Bundle name
'example_dags' is a reserved name."):
DagBundlesManager().parse_config()
+
+
+def test_get_all_bundle_names():
+ assert DagBundlesManager().get_all_bundle_names() == ["dags-folder",
"example_dags"]