|
39 | 39 |
|
40 | 40 | from airflow import settings
|
41 | 41 | from airflow._shared.timezones import timezone
|
42 |
| -from airflow.api_fastapi.execution_api.datamodels.taskinstance import TIRunContext |
| 42 | +from airflow.api_fastapi.execution_api.datamodels.taskinstance import DagRun as DRDataModel, TIRunContext |
43 | 43 | from airflow.callbacks.callback_requests import DagCallbackRequest, DagRunContext, TaskCallbackRequest
|
44 | 44 | from airflow.configuration import conf
|
45 | 45 | from airflow.dag_processing.bundles.base import BundleUsageTrackingManager
|
@@ -768,6 +768,7 @@ def process_executor_events(
|
768 | 768 | select(TI)
|
769 | 769 | .where(filter_for_tis)
|
770 | 770 | .options(selectinload(TI.dag_model))
|
| 771 | + .options(selectinload(TI.dag_run).selectinload(DagRun.consumed_asset_events)) |
771 | 772 | .options(joinedload(TI.dag_version))
|
772 | 773 | )
|
773 | 774 | # row lock this entire set of taskinstances to make sure the scheduler doesn't fail when we have
|
@@ -888,7 +889,7 @@ def process_executor_events(
|
888 | 889 | ti=ti,
|
889 | 890 | msg=msg,
|
890 | 891 | context_from_server=TIRunContext(
|
891 |
| - dag_run=ti.dag_run, |
| 892 | + dag_run=DRDataModel.model_validate(ti.dag_run, from_attributes=True), |
892 | 893 | max_tries=ti.max_tries,
|
893 | 894 | variables=[],
|
894 | 895 | connections=[],
|
@@ -2266,7 +2267,7 @@ def _purge_task_instances_without_heartbeats(
|
2266 | 2267 | ti=ti,
|
2267 | 2268 | msg=str(task_instance_heartbeat_timeout_message_details),
|
2268 | 2269 | context_from_server=TIRunContext(
|
2269 |
| - dag_run=ti.dag_run, |
| 2270 | + dag_run=DRDataModel.model_validate(ti.dag_run, from_attributes=True), |
2270 | 2271 | max_tries=ti.max_tries,
|
2271 | 2272 | variables=[],
|
2272 | 2273 | connections=[],
|
|
0 commit comments