Skip to content

Commit

Permalink
Fix dag reserialize not calling bundle initialize (apache#46355)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jedcunningham authored Feb 2, 2025
1 parent 0c41b5c commit cb43352
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions airflow/cli/commands/remote_commands/dag_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit cb43352

Please sign in to comment.