Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions airflow-core/src/airflow/utils/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,16 @@ def get_dag(
if from_db:
raise AirflowException(f"Dag {dag_id!r} could not be found in DagBag read from database.")
manager = DagBundlesManager()
manager.sync_bundles_to_db()
all_bundles = list(manager.get_all_dag_bundles())
for bundle in all_bundles:
bundle.initialize()

with _airflow_parsing_context_manager(dag_id=dag_id):
dag_bag = DagBag(
dag_folder=dagfile_path or bundle.path, bundle_path=bundle.path, include_examples=False
)
dag_bag.sync_to_db(bundle.name, bundle.version)
dag = dag_bag.dags.get(dag_id)
if dag:
break
Expand Down
2 changes: 1 addition & 1 deletion airflow-core/tests/unit/cli/commands/test_dag_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ def test_dag_test_with_custom_timetable(self, mock__get_or_create_dagrun):
)
from airflow.example_dags.plugins.workday import AfterWorkdayTimetable

with mock.patch.object(AfterWorkdayTimetable, "get_next_workday", side_effect=[DEFAULT_DATE]):
with mock.patch.object(AfterWorkdayTimetable, "get_next_workday", return_value=DEFAULT_DATE):
dag_command.dag_test(cli_args)
assert "data_interval" in mock__get_or_create_dagrun.call_args.kwargs

Expand Down
3 changes: 0 additions & 3 deletions airflow-core/tests/unit/cli/commands/test_task_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,6 @@ def test_mapped_task_render(self):
"""
tasks render should render and displays templated fields for a given mapping task
"""
dag = DagBag().get_dag("test_mapped_classic")
dag.sync_to_db()
SerializedDagModel.write_dag(dag, bundle_name="testing")
with redirect_stdout(io.StringIO()) as stdout:
task_command.task_render(
self.parser.parse_args(
Expand Down