Copilot commented on code in PR #61899:
URL: https://github.com/apache/airflow/pull/61899#discussion_r3066471831
##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -1668,6 +1672,33 @@ def _push_xcom_if_needed(result: Any, ti:
RuntimeTaskInstance, log: Logger):
_xcom_push(ti, BaseXCom.XCOM_RETURN_KEY, result,
mapped_length=mapped_length)
+def _push_operator_extra_links_to_xcom(
+ ti: RuntimeTaskInstance,
+ log: Logger,
+ *,
+ link_class_names: set[str] | None = None,
+) -> None:
Review Comment:
The helper name suggests a generic XCom push, but it specifically writes
directly to the metadata DB via `_xcom_push_to_db` (bypassing any custom XCom
backend). Consider renaming to something more explicit (e.g.,
`_push_operator_extra_links_to_db_xcom` /
`_push_operator_extra_links_to_xcom_db`) to reduce confusion and prevent future
misuse.
##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -1668,6 +1672,33 @@ def _push_xcom_if_needed(result: Any, ti:
RuntimeTaskInstance, log: Logger):
_xcom_push(ti, BaseXCom.XCOM_RETURN_KEY, result,
mapped_length=mapped_length)
+def _push_operator_extra_links_to_xcom(
+ ti: RuntimeTaskInstance,
+ log: Logger,
+ *,
+ link_class_names: set[str] | None = None,
+) -> None:
+ task = ti.task
+ # Push link values to DB XCom for serialized operators. This allows
webserver lookups
Review Comment:
This comment claims the behavior is specific to “serialized operators”, but
the implementation iterates over `task.operator_extra_links` unconditionally
(and `finalize()` calls it for all tasks). Please reword the comment to match
the actual behavior (e.g., explain that DB XCom is written to support webserver
lookups without importing task modules, without implying it only happens for
serialized operators).
```suggestion
# Push link values to DB XCom so the webserver can resolve operator
extra links
```
--
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]