uranusjr commented on code in PR #56973:
URL: https://github.com/apache/airflow/pull/56973#discussion_r2489085303
##########
providers/standard/src/airflow/providers/standard/operators/trigger_dagrun.py:
##########
@@ -79,16 +80,31 @@ def get_link(self, operator: BaseOperator, *, ti_key:
TaskInstanceKey) -> str:
if TYPE_CHECKING:
assert isinstance(operator, TriggerDagRunOperator)
- trigger_dag_id = operator.trigger_dag_id
- if not AIRFLOW_V_3_0_PLUS:
- from airflow.models.renderedtifields import
RenderedTaskInstanceFields
-
- if template_fields :=
RenderedTaskInstanceFields.get_templated_fields(ti_key):
- trigger_dag_id: str = template_fields.get("trigger_dag_id",
operator.trigger_dag_id) # type: ignore[no-redef]
+ # Try to get the resolved dag_id from XCom first (for dynamic dag_ids)
+ trigger_dag_id = None
+ try:
+ trigger_dag_id = XCom.get_value(ti_key=ti_key, key=XCOM_DAG_ID)
+ except (ImportError, AttributeError):
+ # Fallback for test environments or when supervisor comms is not
available
+ pass
Review Comment:
This does not looks right. Tests should using mocking instead; the code
shouldn’t need to have a special case for them.
--
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]