harjeevanmaan commented on code in PR #41384:
URL: https://github.com/apache/airflow/pull/41384#discussion_r1724942144


##########
airflow/api/common/mark_tasks.py:
##########
@@ -164,7 +164,7 @@ def get_all_dag_task_query(
     qry_dag = select(TaskInstance).where(
         TaskInstance.dag_id == dag.dag_id,
         TaskInstance.run_id.in_(run_ids),
-        TaskInstance.ti_selector_condition(task_ids),
+        TaskInstance.ti_selector_condition(task_ids, session=session),

Review Comment:
   @uranusjr Thanks for your review!. The session needs to be a `kwarg` of 
`ti_selector_condition` since the entire logic of filtering revolves around 
being able to filter out using SQL queries. If the `session` kwarg is not 
passed the function is decorated by `@provide_session,` which will handle 
session creation.
   One of the tests failed once I removed the session kwarg because of 
inconsistency between a `taskinstance` and `session,` the `@provide_session` 
created a new session which lead to this inconsistency.
   But if the session is persisted as is shown in the PR, this inconsistency 
would not occur.  



##########
airflow/api/common/mark_tasks.py:
##########
@@ -164,7 +164,7 @@ def get_all_dag_task_query(
     qry_dag = select(TaskInstance).where(
         TaskInstance.dag_id == dag.dag_id,
         TaskInstance.run_id.in_(run_ids),
-        TaskInstance.ti_selector_condition(task_ids),
+        TaskInstance.ti_selector_condition(task_ids, session=session),

Review Comment:
   @uranusjr Thanks for your review! The session needs to be a `kwarg` of 
`ti_selector_condition` since the entire logic of filtering revolves around 
being able to filter out using SQL queries. If the `session` kwarg is not 
passed the function is decorated by `@provide_session,` which will handle 
session creation.
   One of the tests failed once I removed the session kwarg because of 
inconsistency between a `taskinstance` and `session,` the `@provide_session` 
created a new session which lead to this inconsistency.
   But if the session is persisted as is shown in the PR, this inconsistency 
would not occur.  



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