jason810496 commented on code in PR #55160:
URL: https://github.com/apache/airflow/pull/55160#discussion_r2316026777
##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/event_logs.py:
##########
@@ -41,6 +41,9 @@ class EventLogResponse(BaseModel):
dag_display_name: str | None = Field(
validation_alias=AliasPath("dag_model", "dag_display_name"),
default=None
)
+ task_display_name: str | None = Field(
+ validation_alias=AliasPath("task_instance", "task_display_name"),
default=None
+ )
Review Comment:
If I get the context correctly, there are the cases where `dag_id` and
`task_id` both will be `None`.
Take `delete_asset_queued_events` route as example:
https://github.com/apache/airflow/blob/c29696cf2888e858551e7b782c94f66564abeeb2/airflow-core/src/airflow/api_fastapi/core_api/routes/public/assets.py#L554-L563
We can't get either `dag_id` or `task_id` from the query params and path
params.
https://github.com/apache/airflow/blob/c29696cf2888e858551e7b782c94f66564abeeb2/airflow-core/src/airflow/api_fastapi/logging/decorators.py#L140-L150
##########
airflow-core/src/airflow/models/log.py:
##########
@@ -56,6 +56,13 @@ class Log(Base):
primaryjoin="Log.dag_id == DagModel.dag_id",
)
+ task_instance = relationship(
+ "TaskInstance",
+ viewonly=True,
+ foreign_keys=[task_id],
+ primaryjoin="Log.task_id == TaskInstance.task_id",
+ )
+
Review Comment:
We have discussed the usage of `relationship` before at
https://github.com/apache/airflow/pull/54820#pullrequestreview-3144771835. Does
this mean it depends on the model in each case, rather than having all
`relationship` definitions be the same?
--
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]