Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
)


class EventLogCollectionResponse(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10660,6 +10660,11 @@ components:
- type: string
- type: 'null'
title: Dag Display Name
task_display_name:
anyOf:
- type: string
- type: 'null'
title: Task Display Name
type: object
required:
- event_log_id
Expand Down
7 changes: 7 additions & 0 deletions airflow-core/src/airflow/models/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)

__table_args__ = (
Index("idx_log_dttm", dttm),
Index("idx_log_event", event),
Expand Down
11 changes: 11 additions & 0 deletions airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3341,6 +3341,17 @@ export const $EventLogResponse = {
}
],
title: 'Dag Display Name'
},
task_display_name: {
anyOf: [
{
type: 'string'
},
{
type: 'null'
}
],
title: 'Task Display Name'
}
},
type: 'object',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@ export type EventLogResponse = {
owner: string | null;
extra: string | null;
dag_display_name?: string | null;
task_display_name?: string | null;
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
DAG_DISPLAY_NAME = "TEST_DAG_ID"
DAG_RUN_ID = "TEST_DAG_RUN_ID"
TASK_ID = "TEST_TASK_ID"
TASK_DISPLAY_NAME = "TEST_TASK_ID"
DAG_EXECUTION_DATE = datetime(2024, 6, 15, 0, 0, tzinfo=timezone.utc)
OWNER = "TEST_OWNER"
OWNER_DISPLAY_NAME = "Test Owner"
Expand Down Expand Up @@ -135,6 +136,7 @@ class TestGetEventLog(TestEventLogsEndpoint):
"owner": OWNER_AIRFLOW,
"run_id": DAG_RUN_ID,
"task_id": TASK_ID,
"task_display_name": TASK_DISPLAY_NAME,
},
),
(
Expand All @@ -148,6 +150,7 @@ class TestGetEventLog(TestEventLogsEndpoint):
"owner": OWNER,
"run_id": DAG_RUN_ID,
"task_id": TASK_ID,
"task_display_name": TASK_DISPLAY_NAME,
"try_number": 0,
},
),
Expand All @@ -168,6 +171,7 @@ def test_get_event_log(self, test_client, setup, event_log_key, expected_status_
"dag_display_name": expected_body.get("dag_display_name"),
"dag_id": expected_body.get("dag_id"),
"task_id": expected_body.get("task_id"),
"task_display_name": expected_body.get("task_display_name"),
"run_id": expected_body.get("run_id"),
"map_index": event_log.map_index,
"try_number": event_log.try_number,
Expand Down
1 change: 1 addition & 0 deletions airflow-ctl/src/airflowctl/api/datamodels/generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ class EventLogResponse(BaseModel):
owner: Annotated[str | None, Field(title="Owner")] = None
extra: Annotated[str | None, Field(title="Extra")] = None
dag_display_name: Annotated[str | None, Field(title="Dag Display Name")] = None
task_display_name: Annotated[str | None, Field(title="Task Display Name")] = None


class ExternalLogUrlResponse(BaseModel):
Expand Down