pierrejeambrun commented on code in PR #55257:
URL: https://github.com/apache/airflow/pull/55257#discussion_r2348840137
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/extra_links.py:
##########
@@ -87,6 +88,26 @@ def get_extra_links(
)
all_extra_links = {link_name: link_url or None for link_name, link_url in
sorted(all_extra_link_pairs)}
+ extra_link_records = (
+ session.query(XCom)
+ .filter(
+ XCom.dag_id == dag_id,
+ XCom.run_id == dag_run_id,
+ XCom.task_id == task_id,
+ XCom.map_index == map_index,
+ XCom.key.like("extra_link:%"),
+ )
+ .all()
Review Comment:
This is weird, that could actually be another key that has nothing to do
with links that start with `extra_link`.
Also having some parts of the `extra_links` fetched from DB tables through
xcom, and some other `operator_extra_links` coming from `get_extra_links` seems
weird. Not sure to have a better alternative in the current state.
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/extra_links.py:
##########
@@ -87,6 +88,26 @@ def get_extra_links(
)
all_extra_links = {link_name: link_url or None for link_name, link_url in
sorted(all_extra_link_pairs)}
+ extra_link_records = (
+ session.query(XCom)
+ .filter(
+ XCom.dag_id == dag_id,
+ XCom.run_id == dag_run_id,
+ XCom.task_id == task_id,
+ XCom.map_index == map_index,
+ XCom.key.like("extra_link:%"),
+ )
+ .all()
+ )
+ for rec in extra_link_records:
+ link_name = rec.key.split("extra_link:")[1]
+ try:
+ url = rec.value
+ except Exception:
+ url = None
Review Comment:
Catching all exception is not great. We could silence useful unexpected
error. What is the case we are trying to handle particularly here?
(`Xcom.value` shouldn't throw an error)
##########
task-sdk/src/airflow/sdk/execution_time/task_runner.py:
##########
@@ -196,6 +196,7 @@ def get_template_context(self) -> Context:
"value": VariableAccessor(deserialize_json=False),
},
"conn": ConnectionAccessor(),
+ "extra_links": {},
Review Comment:
Is that correct to provide an empty object here? I'm not familiar with task
sdk code, but looking at other attributes it doesn't seem constant.
--
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]