jason810496 commented on code in PR #75795:
URL: https://github.com/apache/airflow/pull/75795#discussion_r4396228113


##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -382,7 +383,10 @@ def ti_run(
         if first_task_reschedule_start_date is not None:
             context.first_task_reschedule_start_date = 
first_task_reschedule_start_date
 
-        serialized_task = get_task(dag_bag, ti, session=session)
+        # Avoid loading the serialized Dag on the normal Python task path: 
only a lang-SDK
+        # (foreign-runtime) task needs its definition here, and ti.is_stub 
carries the row's own copy
+        # of the serialized flag.
+        serialized_task = get_task(dag_bag, ti, session=session) if ti.is_stub 
else None

Review Comment:
   I make sure all the SDK write the `is_stub` properly in this PR as well.



##########
airflow-core/tests/unit/dag_processing/test_dagbag.py:
##########
@@ -1660,6 +1660,17 @@ def test_recorded_runtime_payloads_are_valid(data):
     DagSerialization.validate_serialized_dag(data)
 
 
[email protected]("data", _recorded_payloads())
+def test_recorded_runtime_payloads_mark_their_tasks_as_stubs(data):
+    """ti_run derives arg_bindings only for a stub task, so a Dag defined in a 
language SDK has to say so."""
+    dag = DagSerialization.from_dict(data)
+    for task_id, task in dag.task_dict.items():
+        # A Go or Java TriggerDagRun task is the Python operator itself and 
runs in-process. The

Review Comment:
   Ditto.



##########
airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_task_instances.py:
##########
@@ -2108,6 +2153,8 @@ def 
test_ti_run_skips_queued_duration_metric_when_the_response_fails(
             dag_id=str(uuid4()),
         )
         ti.queued_dttm = queued_at
+        # The route reads a serialized spec only for a stub task, which is 
what fails below.
+        ti.is_stub = True

Review Comment:
   Removed the comment.



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