KyleJamesWalker commented on code in PR #65351:
URL: https://github.com/apache/airflow/pull/65351#discussion_r3102709118


##########
task-sdk/src/airflow/sdk/definitions/dag.py:
##########
@@ -1473,9 +1479,11 @@ def _run_task(
             ti.task = create_scheduler_operator(taskrun_result.ti.task)
 
             if ti.state == TaskInstanceState.DEFERRED and isinstance(msg, 
DeferTask) and run_triggerer:
-                # API Server expects the task instance to be in QUEUED state 
before
-                # resuming from deferral.
-                ti.set_state(TaskInstanceState.QUEUED)
+                # API Server expects the task instance to be in QUEUED state
+                # before resuming from deferral (same cross-thread visibility
+                # concern as above).
+                with create_session(scoped=False) as session:
+                    ti.set_state(TaskInstanceState.QUEUED, session=session)

Review Comment:
   @kaxil I pushed some more changes based on this, but I want to get a local 
dag and this fork running to fully test the changes more fully.



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