jedcunningham commented on code in PR #55139:
URL: https://github.com/apache/airflow/pull/55139#discussion_r2316541944
##########
airflow-core/src/airflow/cli/commands/dag_command.py:
##########
@@ -363,23 +363,21 @@ def dag_list_dags(args, session: Session = NEW_SESSION)
-> None:
dagbag_import_errors = 0
dags_list = []
if args.local:
- from airflow.models.dagbag import DagBag
-
+ manager = DagBundlesManager()
# Get import errors from the local area
if args.bundle_name:
- manager = DagBundlesManager()
validate_dag_bundle_arg(args.bundle_name)
all_bundles = list(manager.get_all_dag_bundles())
bundles_to_search = set(args.bundle_name)
for bundle in all_bundles:
if bundle.name in bundles_to_search:
- dagbag = DagBag(bundle.path, bundle_path=bundle.path)
+ dagbag = manager.get_dagbag(dag_folder=bundle.path,
bundle_path=bundle.path)
dagbag.collect_dags()
dags_list.extend(list(dagbag.dags.values()))
dagbag_import_errors += len(dagbag.import_errors)
else:
- dagbag = DagBag()
+ dagbag = manager.get_dagbag()
Review Comment:
You aren't changing this, but this is wrong :( it's not bundle aware.
##########
airflow-core/src/airflow/dag_processing/bundles/manager.py:
##########
@@ -292,3 +293,9 @@ def view_url(self, name: str, version: str | None = None)
-> str | None:
)
bundle = self.get_bundle(name, version)
return bundle.view_url(version=version)
+
+ @staticmethod
+ def get_dagbag(**kwargs) -> DagBagType:
Review Comment:
I'm a bit torn on this method to be honest. Feels like if we are going to do
something like this, it should just give you a bag for a specific bundle (e.g.
`manager.get_dagbag(bundle=somebundle)` or
`manager.get_dagbag(bundle_name="somename")`).
I think I'm in favor of just letting folks continue to use DagBag directly
like they do today though. e.g.
```
bag = DagBag(bundle.path, bundle_path=bundle.path)
```
--
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]