From 60516aaa9c55a76057ad471e781aa48e680fa2b6 Mon Sep 17 00:00:00 2001 From: kalyanr Date: Fri, 23 May 2025 08:43:04 +0530 Subject: [PATCH 1/3] add deadline to DagResponse --- .../api_fastapi/core_api/datamodels/dags.py | 2 + .../core_api/datamodels/deadline.py | 30 +++++++ .../core_api/openapi/_private_ui.yaml | 33 ++++++++ .../openapi/v2-rest-api-generated.yaml | 41 ++++++++++ .../ui/openapi-gen/requests/schemas.gen.ts | 79 +++++++++++++++++++ .../ui/openapi-gen/requests/types.gen.ts | 15 ++++ .../ui/src/pages/DagsList/DagCard.test.tsx | 1 + .../core_api/routes/public/test_dags.py | 2 + .../airflowctl/api/datamodels/generated.py | 13 +++ 9 files changed, 216 insertions(+) create mode 100644 airflow-core/src/airflow/api_fastapi/core_api/datamodels/deadline.py diff --git a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py index c7d3c5b4b9004..1801d03df7870 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py @@ -35,6 +35,7 @@ from airflow.api_fastapi.core_api.base import BaseModel, StrictBaseModel from airflow.api_fastapi.core_api.datamodels.dag_tags import DagTagResponse from airflow.api_fastapi.core_api.datamodels.dag_versions import DagVersionResponse +from airflow.api_fastapi.core_api.datamodels.deadline import DeadlineAlertResponse from airflow.configuration import conf from airflow.models.dag_version import DagVersion @@ -67,6 +68,7 @@ class DAGResponse(BaseModel): relative_fileloc: str | None fileloc: str description: str | None + deadline: list[DeadlineAlertResponse] | None timetable_summary: str | None timetable_description: str | None tags: list[DagTagResponse] diff --git a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/deadline.py b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/deadline.py new file mode 100644 index 0000000000000..704c218208e4f --- /dev/null +++ b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/deadline.py @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +from datetime import timedelta + +from airflow.api_fastapi.core_api.base import BaseModel + + +class DeadlineAlertResponse(BaseModel): + """Deadline alert serializer for responses.""" + + reference: str + interval: timedelta + callback: str + callback_kwargs: dict | None = None diff --git a/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml b/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml index 920263e8f2085..660580cbe8400 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml +++ b/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml @@ -1090,6 +1090,13 @@ components: - type: string - type: 'null' title: Description + deadline: + anyOf: + - items: + $ref: '#/components/schemas/DeadlineAlertResponse' + type: array + - type: 'null' + title: Deadline timetable_summary: anyOf: - type: string @@ -1180,6 +1187,7 @@ components: - relative_fileloc - fileloc - description + - deadline - timetable_summary - timetable_description - tags @@ -1319,6 +1327,31 @@ components: - queued_dag_count title: DashboardDagStatsResponse description: Dashboard DAG Stats serializer for responses. + DeadlineAlertResponse: + properties: + reference: + type: string + title: Reference + interval: + type: string + format: duration + title: Interval + callback: + type: string + title: Callback + callback_kwargs: + anyOf: + - additionalProperties: true + type: object + - type: 'null' + title: Callback Kwargs + type: object + required: + - reference + - interval + - callback + title: DeadlineAlertResponse + description: Deadline alert serializer for responses. EdgeResponse: properties: source_id: diff --git a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml index 582807ad74bb3..12b0edf60ecfd 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml +++ b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml @@ -8171,6 +8171,13 @@ components: - type: string - type: 'null' title: Description + deadline: + anyOf: + - items: + $ref: '#/components/schemas/DeadlineAlertResponse' + type: array + - type: 'null' + title: Deadline timetable_summary: anyOf: - type: string @@ -8338,6 +8345,7 @@ components: - relative_fileloc - fileloc - description + - deadline - timetable_summary - timetable_description - tags @@ -8429,6 +8437,13 @@ components: - type: string - type: 'null' title: Description + deadline: + anyOf: + - items: + $ref: '#/components/schemas/DeadlineAlertResponse' + type: array + - type: 'null' + title: Deadline timetable_summary: anyOf: - type: string @@ -8508,6 +8523,7 @@ components: - relative_fileloc - fileloc - description + - deadline - timetable_summary - timetable_description - tags @@ -9120,6 +9136,31 @@ components: This is the set of allowable values for the ``warning_type`` field in the DagWarning model.' + DeadlineAlertResponse: + properties: + reference: + type: string + title: Reference + interval: + type: string + format: duration + title: Interval + callback: + type: string + title: Callback + callback_kwargs: + anyOf: + - additionalProperties: true + type: object + - type: 'null' + title: Callback Kwargs + type: object + required: + - reference + - interval + - callback + title: DeadlineAlertResponse + description: Deadline alert serializer for responses. DryRunBackfillCollectionResponse: properties: backfills: diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts index 56bb0fe4f1bff..0521c2b9f1fb9 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts @@ -1677,6 +1677,20 @@ export const $DAGDetailsResponse = { ], title: "Description", }, + deadline: { + anyOf: [ + { + items: { + $ref: "#/components/schemas/DeadlineAlertResponse", + }, + type: "array", + }, + { + type: "null", + }, + ], + title: "Deadline", + }, timetable_summary: { anyOf: [ { @@ -1979,6 +1993,7 @@ export const $DAGDetailsResponse = { "relative_fileloc", "fileloc", "description", + "deadline", "timetable_summary", "timetable_description", "tags", @@ -2117,6 +2132,20 @@ export const $DAGResponse = { ], title: "Description", }, + deadline: { + anyOf: [ + { + items: { + $ref: "#/components/schemas/DeadlineAlertResponse", + }, + type: "array", + }, + { + type: "null", + }, + ], + title: "Deadline", + }, timetable_summary: { anyOf: [ { @@ -2248,6 +2277,7 @@ export const $DAGResponse = { "relative_fileloc", "fileloc", "description", + "deadline", "timetable_summary", "timetable_description", "tags", @@ -3150,6 +3180,40 @@ This is the set of allowable values for the \`\`warning_type\`\` field in the DagWarning model.`, } as const; +export const $DeadlineAlertResponse = { + properties: { + reference: { + type: "string", + title: "Reference", + }, + interval: { + type: "string", + format: "duration", + title: "Interval", + }, + callback: { + type: "string", + title: "Callback", + }, + callback_kwargs: { + anyOf: [ + { + additionalProperties: true, + type: "object", + }, + { + type: "null", + }, + ], + title: "Callback Kwargs", + }, + }, + type: "object", + required: ["reference", "interval", "callback"], + title: "DeadlineAlertResponse", + description: "Deadline alert serializer for responses.", +} as const; + export const $DryRunBackfillCollectionResponse = { properties: { backfills: { @@ -6608,6 +6672,20 @@ export const $DAGWithLatestDagRunsResponse = { ], title: "Description", }, + deadline: { + anyOf: [ + { + items: { + $ref: "#/components/schemas/DeadlineAlertResponse", + }, + type: "array", + }, + { + type: "null", + }, + ], + title: "Deadline", + }, timetable_summary: { anyOf: [ { @@ -6758,6 +6836,7 @@ export const $DAGWithLatestDagRunsResponse = { "relative_fileloc", "fileloc", "description", + "deadline", "timetable_summary", "timetable_description", "tags", diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts index 79a67a37f8d32..d18d17afd5e3f 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts @@ -497,6 +497,7 @@ export type DAGDetailsResponse = { relative_fileloc: string | null; fileloc: string; description: string | null; + deadline: Array | null; timetable_summary: string | null; timetable_description: string | null; tags: Array; @@ -568,6 +569,7 @@ export type DAGResponse = { relative_fileloc: string | null; fileloc: string; description: string | null; + deadline: Array | null; timetable_summary: string | null; timetable_description: string | null; tags: Array; @@ -818,6 +820,18 @@ export type DagVersionResponse = { */ export type DagWarningType = "asset conflict" | "non-existent pool"; +/** + * Deadline alert serializer for responses. + */ +export type DeadlineAlertResponse = { + reference: string; + interval: string; + callback: string; + callback_kwargs?: { + [key: string]: unknown; + } | null; +}; + /** * Backfill collection serializer for responses in dry-run mode. */ @@ -1654,6 +1668,7 @@ export type DAGWithLatestDagRunsResponse = { relative_fileloc: string | null; fileloc: string; description: string | null; + deadline: Array | null; timetable_summary: string | null; timetable_description: string | null; tags: Array; diff --git a/airflow-core/src/airflow/ui/src/pages/DagsList/DagCard.test.tsx b/airflow-core/src/airflow/ui/src/pages/DagsList/DagCard.test.tsx index f62769c3cab0f..d95e4466be5cf 100644 --- a/airflow-core/src/airflow/ui/src/pages/DagsList/DagCard.test.tsx +++ b/airflow-core/src/airflow/ui/src/pages/DagsList/DagCard.test.tsx @@ -33,6 +33,7 @@ const mockDag = { bundle_version: "1", dag_display_name: "nested_groups", dag_id: "nested_groups", + deadline: null, description: null, file_token: "Ii9maWxlcy9kYWdzL25lc3RlZF90YXNrX2dyb3Vwcy5weSI.G3EkdxmDUDQsVb7AIZww1TSGlFE", fileloc: "/files/dags/nested_task_groups.py", diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py index ebf17f5588557..4af37668482d1 100644 --- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py +++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py @@ -439,6 +439,7 @@ def test_dag_details( }, "description": None, "doc_md": "details", + "deadline": None, "end_date": None, "fileloc": __file__, "file_token": file_token, @@ -527,6 +528,7 @@ def test_get_dag(self, test_client, query_params, dag_id, expected_status_code, "is_stale": False, "owners": ["airflow"], "timetable_summary": None, + "deadline": None, "tags": [], "has_task_concurrency_limits": True, "next_dagrun_data_interval_start": None, diff --git a/airflow-ctl/src/airflowctl/api/datamodels/generated.py b/airflow-ctl/src/airflowctl/api/datamodels/generated.py index 330b2a91f72c7..4d082b884f7ac 100644 --- a/airflow-ctl/src/airflowctl/api/datamodels/generated.py +++ b/airflow-ctl/src/airflowctl/api/datamodels/generated.py @@ -468,6 +468,17 @@ class DagWarningType(str, Enum): NON_EXISTENT_POOL = "non-existent pool" +class DeadlineAlertResponse(BaseModel): + """ + Deadline alert serializer for responses. + """ + + reference: Annotated[str, Field(title="Reference")] + interval: Annotated[timedelta, Field(title="Interval")] + callback: Annotated[str, Field(title="Callback")] + callback_kwargs: Annotated[dict[str, Any] | None, Field(title="Callback Kwargs")] = None + + class DryRunBackfillResponse(BaseModel): """ Backfill serializer for responses in dry-run mode. @@ -1215,6 +1226,7 @@ class DAGDetailsResponse(BaseModel): relative_fileloc: Annotated[str | None, Field(title="Relative Fileloc")] = None fileloc: Annotated[str, Field(title="Fileloc")] description: Annotated[str | None, Field(title="Description")] = None + deadline: Annotated[list[DeadlineAlertResponse] | None, Field(title="Deadline")] = None timetable_summary: Annotated[str | None, Field(title="Timetable Summary")] = None timetable_description: Annotated[str | None, Field(title="Timetable Description")] = None tags: Annotated[list[DagTagResponse], Field(title="Tags")] @@ -1271,6 +1283,7 @@ class DAGResponse(BaseModel): relative_fileloc: Annotated[str | None, Field(title="Relative Fileloc")] = None fileloc: Annotated[str, Field(title="Fileloc")] description: Annotated[str | None, Field(title="Description")] = None + deadline: Annotated[list[DeadlineAlertResponse] | None, Field(title="Deadline")] = None timetable_summary: Annotated[str | None, Field(title="Timetable Summary")] = None timetable_description: Annotated[str | None, Field(title="Timetable Description")] = None tags: Annotated[list[DagTagResponse], Field(title="Tags")] From a3dc74b1abcbb52804d0ca785255e07c5f1e3fe7 Mon Sep 17 00:00:00 2001 From: kalyanr Date: Fri, 23 May 2025 08:43:04 +0530 Subject: [PATCH 2/3] add deadline to DagResponse --- .../api_fastapi/core_api/datamodels/dags.py | 2 + .../core_api/datamodels/deadline.py | 30 +++++++ .../core_api/openapi/_private_ui.yaml | 33 ++++++++ .../openapi/v2-rest-api-generated.yaml | 41 ++++++++++ .../ui/openapi-gen/requests/schemas.gen.ts | 79 +++++++++++++++++++ .../ui/openapi-gen/requests/types.gen.ts | 15 ++++ .../ui/src/pages/DagsList/DagCard.test.tsx | 1 + .../core_api/routes/public/test_dags.py | 2 + .../airflowctl/api/datamodels/generated.py | 13 +++ 9 files changed, 216 insertions(+) create mode 100644 airflow-core/src/airflow/api_fastapi/core_api/datamodels/deadline.py diff --git a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py index c7d3c5b4b9004..1801d03df7870 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/dags.py @@ -35,6 +35,7 @@ from airflow.api_fastapi.core_api.base import BaseModel, StrictBaseModel from airflow.api_fastapi.core_api.datamodels.dag_tags import DagTagResponse from airflow.api_fastapi.core_api.datamodels.dag_versions import DagVersionResponse +from airflow.api_fastapi.core_api.datamodels.deadline import DeadlineAlertResponse from airflow.configuration import conf from airflow.models.dag_version import DagVersion @@ -67,6 +68,7 @@ class DAGResponse(BaseModel): relative_fileloc: str | None fileloc: str description: str | None + deadline: list[DeadlineAlertResponse] | None timetable_summary: str | None timetable_description: str | None tags: list[DagTagResponse] diff --git a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/deadline.py b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/deadline.py new file mode 100644 index 0000000000000..704c218208e4f --- /dev/null +++ b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/deadline.py @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +from datetime import timedelta + +from airflow.api_fastapi.core_api.base import BaseModel + + +class DeadlineAlertResponse(BaseModel): + """Deadline alert serializer for responses.""" + + reference: str + interval: timedelta + callback: str + callback_kwargs: dict | None = None diff --git a/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml b/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml index 920263e8f2085..660580cbe8400 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml +++ b/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml @@ -1090,6 +1090,13 @@ components: - type: string - type: 'null' title: Description + deadline: + anyOf: + - items: + $ref: '#/components/schemas/DeadlineAlertResponse' + type: array + - type: 'null' + title: Deadline timetable_summary: anyOf: - type: string @@ -1180,6 +1187,7 @@ components: - relative_fileloc - fileloc - description + - deadline - timetable_summary - timetable_description - tags @@ -1319,6 +1327,31 @@ components: - queued_dag_count title: DashboardDagStatsResponse description: Dashboard DAG Stats serializer for responses. + DeadlineAlertResponse: + properties: + reference: + type: string + title: Reference + interval: + type: string + format: duration + title: Interval + callback: + type: string + title: Callback + callback_kwargs: + anyOf: + - additionalProperties: true + type: object + - type: 'null' + title: Callback Kwargs + type: object + required: + - reference + - interval + - callback + title: DeadlineAlertResponse + description: Deadline alert serializer for responses. EdgeResponse: properties: source_id: diff --git a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml index 582807ad74bb3..12b0edf60ecfd 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml +++ b/airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml @@ -8171,6 +8171,13 @@ components: - type: string - type: 'null' title: Description + deadline: + anyOf: + - items: + $ref: '#/components/schemas/DeadlineAlertResponse' + type: array + - type: 'null' + title: Deadline timetable_summary: anyOf: - type: string @@ -8338,6 +8345,7 @@ components: - relative_fileloc - fileloc - description + - deadline - timetable_summary - timetable_description - tags @@ -8429,6 +8437,13 @@ components: - type: string - type: 'null' title: Description + deadline: + anyOf: + - items: + $ref: '#/components/schemas/DeadlineAlertResponse' + type: array + - type: 'null' + title: Deadline timetable_summary: anyOf: - type: string @@ -8508,6 +8523,7 @@ components: - relative_fileloc - fileloc - description + - deadline - timetable_summary - timetable_description - tags @@ -9120,6 +9136,31 @@ components: This is the set of allowable values for the ``warning_type`` field in the DagWarning model.' + DeadlineAlertResponse: + properties: + reference: + type: string + title: Reference + interval: + type: string + format: duration + title: Interval + callback: + type: string + title: Callback + callback_kwargs: + anyOf: + - additionalProperties: true + type: object + - type: 'null' + title: Callback Kwargs + type: object + required: + - reference + - interval + - callback + title: DeadlineAlertResponse + description: Deadline alert serializer for responses. DryRunBackfillCollectionResponse: properties: backfills: diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts index 56bb0fe4f1bff..0521c2b9f1fb9 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts @@ -1677,6 +1677,20 @@ export const $DAGDetailsResponse = { ], title: "Description", }, + deadline: { + anyOf: [ + { + items: { + $ref: "#/components/schemas/DeadlineAlertResponse", + }, + type: "array", + }, + { + type: "null", + }, + ], + title: "Deadline", + }, timetable_summary: { anyOf: [ { @@ -1979,6 +1993,7 @@ export const $DAGDetailsResponse = { "relative_fileloc", "fileloc", "description", + "deadline", "timetable_summary", "timetable_description", "tags", @@ -2117,6 +2132,20 @@ export const $DAGResponse = { ], title: "Description", }, + deadline: { + anyOf: [ + { + items: { + $ref: "#/components/schemas/DeadlineAlertResponse", + }, + type: "array", + }, + { + type: "null", + }, + ], + title: "Deadline", + }, timetable_summary: { anyOf: [ { @@ -2248,6 +2277,7 @@ export const $DAGResponse = { "relative_fileloc", "fileloc", "description", + "deadline", "timetable_summary", "timetable_description", "tags", @@ -3150,6 +3180,40 @@ This is the set of allowable values for the \`\`warning_type\`\` field in the DagWarning model.`, } as const; +export const $DeadlineAlertResponse = { + properties: { + reference: { + type: "string", + title: "Reference", + }, + interval: { + type: "string", + format: "duration", + title: "Interval", + }, + callback: { + type: "string", + title: "Callback", + }, + callback_kwargs: { + anyOf: [ + { + additionalProperties: true, + type: "object", + }, + { + type: "null", + }, + ], + title: "Callback Kwargs", + }, + }, + type: "object", + required: ["reference", "interval", "callback"], + title: "DeadlineAlertResponse", + description: "Deadline alert serializer for responses.", +} as const; + export const $DryRunBackfillCollectionResponse = { properties: { backfills: { @@ -6608,6 +6672,20 @@ export const $DAGWithLatestDagRunsResponse = { ], title: "Description", }, + deadline: { + anyOf: [ + { + items: { + $ref: "#/components/schemas/DeadlineAlertResponse", + }, + type: "array", + }, + { + type: "null", + }, + ], + title: "Deadline", + }, timetable_summary: { anyOf: [ { @@ -6758,6 +6836,7 @@ export const $DAGWithLatestDagRunsResponse = { "relative_fileloc", "fileloc", "description", + "deadline", "timetable_summary", "timetable_description", "tags", diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts index 79a67a37f8d32..d18d17afd5e3f 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts @@ -497,6 +497,7 @@ export type DAGDetailsResponse = { relative_fileloc: string | null; fileloc: string; description: string | null; + deadline: Array | null; timetable_summary: string | null; timetable_description: string | null; tags: Array; @@ -568,6 +569,7 @@ export type DAGResponse = { relative_fileloc: string | null; fileloc: string; description: string | null; + deadline: Array | null; timetable_summary: string | null; timetable_description: string | null; tags: Array; @@ -818,6 +820,18 @@ export type DagVersionResponse = { */ export type DagWarningType = "asset conflict" | "non-existent pool"; +/** + * Deadline alert serializer for responses. + */ +export type DeadlineAlertResponse = { + reference: string; + interval: string; + callback: string; + callback_kwargs?: { + [key: string]: unknown; + } | null; +}; + /** * Backfill collection serializer for responses in dry-run mode. */ @@ -1654,6 +1668,7 @@ export type DAGWithLatestDagRunsResponse = { relative_fileloc: string | null; fileloc: string; description: string | null; + deadline: Array | null; timetable_summary: string | null; timetable_description: string | null; tags: Array; diff --git a/airflow-core/src/airflow/ui/src/pages/DagsList/DagCard.test.tsx b/airflow-core/src/airflow/ui/src/pages/DagsList/DagCard.test.tsx index f62769c3cab0f..d95e4466be5cf 100644 --- a/airflow-core/src/airflow/ui/src/pages/DagsList/DagCard.test.tsx +++ b/airflow-core/src/airflow/ui/src/pages/DagsList/DagCard.test.tsx @@ -33,6 +33,7 @@ const mockDag = { bundle_version: "1", dag_display_name: "nested_groups", dag_id: "nested_groups", + deadline: null, description: null, file_token: "Ii9maWxlcy9kYWdzL25lc3RlZF90YXNrX2dyb3Vwcy5weSI.G3EkdxmDUDQsVb7AIZww1TSGlFE", fileloc: "/files/dags/nested_task_groups.py", diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py index ebf17f5588557..4af37668482d1 100644 --- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py +++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py @@ -439,6 +439,7 @@ def test_dag_details( }, "description": None, "doc_md": "details", + "deadline": None, "end_date": None, "fileloc": __file__, "file_token": file_token, @@ -527,6 +528,7 @@ def test_get_dag(self, test_client, query_params, dag_id, expected_status_code, "is_stale": False, "owners": ["airflow"], "timetable_summary": None, + "deadline": None, "tags": [], "has_task_concurrency_limits": True, "next_dagrun_data_interval_start": None, diff --git a/airflow-ctl/src/airflowctl/api/datamodels/generated.py b/airflow-ctl/src/airflowctl/api/datamodels/generated.py index 330b2a91f72c7..4d082b884f7ac 100644 --- a/airflow-ctl/src/airflowctl/api/datamodels/generated.py +++ b/airflow-ctl/src/airflowctl/api/datamodels/generated.py @@ -468,6 +468,17 @@ class DagWarningType(str, Enum): NON_EXISTENT_POOL = "non-existent pool" +class DeadlineAlertResponse(BaseModel): + """ + Deadline alert serializer for responses. + """ + + reference: Annotated[str, Field(title="Reference")] + interval: Annotated[timedelta, Field(title="Interval")] + callback: Annotated[str, Field(title="Callback")] + callback_kwargs: Annotated[dict[str, Any] | None, Field(title="Callback Kwargs")] = None + + class DryRunBackfillResponse(BaseModel): """ Backfill serializer for responses in dry-run mode. @@ -1215,6 +1226,7 @@ class DAGDetailsResponse(BaseModel): relative_fileloc: Annotated[str | None, Field(title="Relative Fileloc")] = None fileloc: Annotated[str, Field(title="Fileloc")] description: Annotated[str | None, Field(title="Description")] = None + deadline: Annotated[list[DeadlineAlertResponse] | None, Field(title="Deadline")] = None timetable_summary: Annotated[str | None, Field(title="Timetable Summary")] = None timetable_description: Annotated[str | None, Field(title="Timetable Description")] = None tags: Annotated[list[DagTagResponse], Field(title="Tags")] @@ -1271,6 +1283,7 @@ class DAGResponse(BaseModel): relative_fileloc: Annotated[str | None, Field(title="Relative Fileloc")] = None fileloc: Annotated[str, Field(title="Fileloc")] description: Annotated[str | None, Field(title="Description")] = None + deadline: Annotated[list[DeadlineAlertResponse] | None, Field(title="Deadline")] = None timetable_summary: Annotated[str | None, Field(title="Timetable Summary")] = None timetable_description: Annotated[str | None, Field(title="Timetable Description")] = None tags: Annotated[list[DagTagResponse], Field(title="Tags")] From 83de12951b1bb0f6f288d72b431493eb1e4f2343 Mon Sep 17 00:00:00 2001 From: Aryan Khurana Date: Sat, 14 Jun 2025 11:41:56 -0400 Subject: [PATCH 3/3] fix: CI test fails by adding deadline field to get_dagbag_dag_details() func --- airflow-core/src/airflow/cli/commands/dag_command.py | 1 + 1 file changed, 1 insertion(+) diff --git a/airflow-core/src/airflow/cli/commands/dag_command.py b/airflow-core/src/airflow/cli/commands/dag_command.py index 3fd3f29f8f429..20b98bb6de1c0 100644 --- a/airflow-core/src/airflow/cli/commands/dag_command.py +++ b/airflow-core/src/airflow/cli/commands/dag_command.py @@ -252,6 +252,7 @@ def _get_dagbag_dag_details(dag: DAG) -> dict: "next_dagrun_data_interval_end": None, "next_dagrun_logical_date": None, "next_dagrun_run_after": None, + "deadline": None, }