sunank200 commented on code in PR #42404:
URL: https://github.com/apache/airflow/pull/42404#discussion_r1848077091


##########
airflow/www/views.py:
##########
@@ -1417,7 +1417,9 @@ def rendered_templates(self, session):
 
         logger.info("Retrieving rendered templates.")
         dag: DAG = get_airflow_app().dag_bag.get_dag(dag_id)
-        dag_run = dag.get_dagrun(logical_date=dttm)
+        dag_run = dag.get_dagrun(
+            select(DagRun.run_id).where(DagRun.logical_date == 
dttm).order_by(DagRun.id.desc()).limit(1)

Review Comment:
   Added it



##########
airflow/www/views.py:
##########
@@ -2144,7 +2146,7 @@ def trigger(self, dag_id: str, session: Session = 
NEW_SESSION):
                 form=form,
             )
 
-        dr = DagRun.find_duplicate(dag_id=dag_id, run_id=run_id, 
logical_date=logical_date)
+        dr = DagRun.find_duplicate(dag_id=dag_id, run_id=run_id)

Review Comment:
   Changed it



##########
tests/sensors/test_external_task_sensor.py:
##########
@@ -1373,9 +1374,17 @@ def 
test_external_task_marker_clear_activate(dag_bag_parent_child, session):
     run_tasks(dag_bag, logical_date=day_1)
     run_tasks(dag_bag, logical_date=day_2)
 
+    from sqlalchemy import select
+
     # Assert that dagruns of all the affected dags are set to SUCCESS before 
tasks are cleared.
     for dag, logical_date in itertools.product(dag_bag.dags.values(), [day_1, 
day_2]):
-        dagrun = dag.get_dagrun(logical_date=logical_date, session=session)
+        dagrun = dag.get_dagrun(
+            run_id=select(DagRun.run_id)
+            .where(DagRun.logical_date == logical_date)
+            .order_by(DagRun.id.desc())
+            .limit(1),
+            session=session,
+        )

Review Comment:
   Done for all of them



-- 
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]

Reply via email to