From cb4335248a0b01e5e09a60dff8a467a758511c9b Mon Sep 17 00:00:00 2001 From: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> Date: Sun, 2 Feb 2025 10:00:33 -0700 Subject: [PATCH] Fix `dag reserialize` not calling bundle initialize (#46355) Some bundle types, like git, require that `initialize` is called before you can call other methods, like `get_current_version`. This was missed when introducing `initialize` though. --- airflow/cli/commands/remote_commands/dag_command.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/airflow/cli/commands/remote_commands/dag_command.py b/airflow/cli/commands/remote_commands/dag_command.py index acd94ff93e078..6c95451271fbc 100644 --- a/airflow/cli/commands/remote_commands/dag_command.py +++ b/airflow/cli/commands/remote_commands/dag_command.py @@ -546,10 +546,12 @@ def dag_reserialize(args, session: Session = NEW_SESSION) -> None: bundle = manager.get_bundle(args.bundle_name) if not bundle: raise SystemExit(f"Bundle {args.bundle_name} not found") + bundle.initialize() dag_bag = DagBag(bundle.path, include_examples=False) dag_bag.sync_to_db(bundle.name, bundle_version=bundle.get_current_version(), session=session) else: bundles = manager.get_all_dag_bundles() for bundle in bundles: + bundle.initialize() dag_bag = DagBag(bundle.path, include_examples=False) dag_bag.sync_to_db(bundle.name, bundle_version=bundle.get_current_version(), session=session)