amoghrajesh commented on code in PR #46613:
URL: https://github.com/apache/airflow/pull/46613#discussion_r1948810412


##########
task_sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -717,7 +717,11 @@ def _push_xcom_if_needed(result: Any, ti: 
RuntimeTaskInstance):
     _xcom_push(ti, "return_value", result, mapped_length=mapped_length)
 
 
-def finalize(log: Logger): ...
+def finalize(ti: RuntimeTaskInstance, log: Logger):
+    for oe in ti.task.operator_extra_link_dict.values():
+        link, xcom_key = oe.get_link(operator=ti.task, ti_key=ti.id), 
oe.xcom_key  # type: ignore[arg-type]
+        log.debug("Setting xcom for operator extra link", link=link, 
xcom_key=xcom_key)
+        _xcom_push(ti, key=xcom_key, value=link)

Review Comment:
   Precisely, thats the behaviour. And also the reason why I kept this in 
finalize.
   
   There's a use case, a link to "how to write a dag effectively" if a dag 
times out due to being poorly written :)



##########
task_sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -717,7 +717,11 @@ def _push_xcom_if_needed(result: Any, ti: 
RuntimeTaskInstance):
     _xcom_push(ti, "return_value", result, mapped_length=mapped_length)
 
 
-def finalize(log: Logger): ...
+def finalize(ti: RuntimeTaskInstance, log: Logger):
+    for oe in ti.task.operator_extra_link_dict.values():
+        link, xcom_key = oe.get_link(operator=ti.task, ti_key=ti.id), 
oe.xcom_key  # type: ignore[arg-type]
+        log.debug("Setting xcom for operator extra link", link=link, 
xcom_key=xcom_key)
+        _xcom_push(ti, key=xcom_key, value=link)

Review Comment:
   Precisely, thats the behaviour. And also the reason why I kept this in 
finalize.
   
   Here's a use case, a link to "how to write a dag effectively" if a dag times 
out due to being poorly written :)



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