dondaum commented on code in PR #39244:
URL: https://github.com/apache/airflow/pull/39244#discussion_r1579606851


##########
airflow/cli/commands/task_command.py:
##########
@@ -199,6 +199,8 @@ def _get_ti_db_access(
             )
         # TODO: Validate map_index is in range?
         ti = TaskInstance(task, run_id=dag_run.run_id, map_index=map_index)
+        if create_if_necessary == "db":
+            session.add(ti)

Review Comment:
   Thanks for the review.
   
   I am not sure if I got your comment right. 
   
   I assume you are asking if we can implement it in a generic way that doesn't 
depend on `create_if_necessary` as if there is a change this might re-open the 
issue again? 
   
   If correct, yes we could check in general if the DagRun object is in session:
   
   ```Python
   
   if dag_run in session:
       session.add(ti)
   ```



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