Skip to content
Merged
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
19 changes: 17 additions & 2 deletions airflow/api_fastapi/core_api/datamodels/dags.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,24 @@
from airflow.api_fastapi.core_api.datamodels.dag_tags import DagTagResponse
from airflow.configuration import conf

DAG_ALIAS_MAPPING: dict[str, str] = {
# The keys are the names in the response, the values are the original names in the model
# This is used to map the names in the response to the names in the model
# See: https://github.com/apache/airflow/issues/46732
"next_dagrun_logical_date": "next_dagrun",
"next_dagrun_run_after": "next_dagrun_create_after",
}


class DAGResponse(BaseModel):
"""DAG serializer for responses."""

model_config = ConfigDict(
alias_generator=AliasGenerator(
validation_alias=lambda field_name: DAG_ALIAS_MAPPING.get(field_name, field_name),
),
)

dag_id: str
dag_display_name: str
is_paused: bool
Expand All @@ -56,10 +70,10 @@ class DAGResponse(BaseModel):
max_consecutive_failed_dag_runs: int
has_task_concurrency_limits: bool
has_import_errors: bool
next_dagrun: datetime | None
next_dagrun_logical_date: datetime | None
next_dagrun_data_interval_start: datetime | None
next_dagrun_data_interval_end: datetime | None
next_dagrun_create_after: datetime | None
next_dagrun_run_after: datetime | None
owners: list[str]

@field_validator("owners", mode="before")
Expand Down Expand Up @@ -115,6 +129,7 @@ class DAGDetailsResponse(DAGResponse):
"dag_run_timeout": "dagrun_timeout",
"last_parsed": "last_loaded",
"template_search_path": "template_searchpath",
**DAG_ALIAS_MAPPING,
}.get(field_name, field_name),
),
)
Expand Down
36 changes: 18 additions & 18 deletions airflow/api_fastapi/core_api/openapi/v1-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7930,12 +7930,12 @@ components:
has_import_errors:
type: boolean
title: Has Import Errors
next_dagrun:
next_dagrun_logical_date:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Next Dagrun
title: Next Dagrun Logical Date
next_dagrun_data_interval_start:
anyOf:
- type: string
Expand All @@ -7948,12 +7948,12 @@ components:
format: date-time
- type: 'null'
title: Next Dagrun Data Interval End
next_dagrun_create_after:
next_dagrun_run_after:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Next Dagrun Create After
title: Next Dagrun Run After
owners:
items:
type: string
Expand Down Expand Up @@ -8050,10 +8050,10 @@ components:
- max_consecutive_failed_dag_runs
- has_task_concurrency_limits
- has_import_errors
- next_dagrun
- next_dagrun_logical_date
- next_dagrun_data_interval_start
- next_dagrun_data_interval_end
- next_dagrun_create_after
- next_dagrun_run_after
- owners
- catchup
- dag_run_timeout
Expand Down Expand Up @@ -8153,12 +8153,12 @@ components:
has_import_errors:
type: boolean
title: Has Import Errors
next_dagrun:
next_dagrun_logical_date:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Next Dagrun
title: Next Dagrun Logical Date
next_dagrun_data_interval_start:
anyOf:
- type: string
Expand All @@ -8171,12 +8171,12 @@ components:
format: date-time
- type: 'null'
title: Next Dagrun Data Interval End
next_dagrun_create_after:
next_dagrun_run_after:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Next Dagrun Create After
title: Next Dagrun Run After
owners:
items:
type: string
Expand Down Expand Up @@ -8206,10 +8206,10 @@ components:
- max_consecutive_failed_dag_runs
- has_task_concurrency_limits
- has_import_errors
- next_dagrun
- next_dagrun_logical_date
- next_dagrun_data_interval_start
- next_dagrun_data_interval_end
- next_dagrun_create_after
- next_dagrun_run_after
- owners
- file_token
title: DAGResponse
Expand Down Expand Up @@ -8667,12 +8667,12 @@ components:
has_import_errors:
type: boolean
title: Has Import Errors
next_dagrun:
next_dagrun_logical_date:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Next Dagrun
title: Next Dagrun Logical Date
next_dagrun_data_interval_start:
anyOf:
- type: string
Expand All @@ -8685,12 +8685,12 @@ components:
format: date-time
- type: 'null'
title: Next Dagrun Data Interval End
next_dagrun_create_after:
next_dagrun_run_after:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Next Dagrun Create After
title: Next Dagrun Run After
owners:
items:
type: string
Expand Down Expand Up @@ -8725,10 +8725,10 @@ components:
- max_consecutive_failed_dag_runs
- has_task_concurrency_limits
- has_import_errors
- next_dagrun
- next_dagrun_logical_date
- next_dagrun_data_interval_start
- next_dagrun_data_interval_end
- next_dagrun_create_after
- next_dagrun_run_after
- owners
- latest_dag_runs
- file_token
Expand Down
36 changes: 18 additions & 18 deletions airflow/ui/openapi-gen/requests/schemas.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,7 @@ export const $DAGDetailsResponse = {
type: "boolean",
title: "Has Import Errors",
},
next_dagrun: {
next_dagrun_logical_date: {
anyOf: [
{
type: "string",
Expand All @@ -1624,7 +1624,7 @@ export const $DAGDetailsResponse = {
type: "null",
},
],
title: "Next Dagrun",
title: "Next Dagrun Logical Date",
},
next_dagrun_data_interval_start: {
anyOf: [
Expand All @@ -1650,7 +1650,7 @@ export const $DAGDetailsResponse = {
],
title: "Next Dagrun Data Interval End",
},
next_dagrun_create_after: {
next_dagrun_run_after: {
anyOf: [
{
type: "string",
Expand All @@ -1660,7 +1660,7 @@ export const $DAGDetailsResponse = {
type: "null",
},
],
title: "Next Dagrun Create After",
title: "Next Dagrun Run After",
},
owners: {
items: {
Expand Down Expand Up @@ -1826,10 +1826,10 @@ export const $DAGDetailsResponse = {
"max_consecutive_failed_dag_runs",
"has_task_concurrency_limits",
"has_import_errors",
"next_dagrun",
"next_dagrun_logical_date",
"next_dagrun_data_interval_start",
"next_dagrun_data_interval_end",
"next_dagrun_create_after",
"next_dagrun_run_after",
"owners",
"catchup",
"dag_run_timeout",
Expand Down Expand Up @@ -1988,7 +1988,7 @@ export const $DAGResponse = {
type: "boolean",
title: "Has Import Errors",
},
next_dagrun: {
next_dagrun_logical_date: {
anyOf: [
{
type: "string",
Expand All @@ -1998,7 +1998,7 @@ export const $DAGResponse = {
type: "null",
},
],
title: "Next Dagrun",
title: "Next Dagrun Logical Date",
},
next_dagrun_data_interval_start: {
anyOf: [
Expand All @@ -2024,7 +2024,7 @@ export const $DAGResponse = {
],
title: "Next Dagrun Data Interval End",
},
next_dagrun_create_after: {
next_dagrun_run_after: {
anyOf: [
{
type: "string",
Expand All @@ -2034,7 +2034,7 @@ export const $DAGResponse = {
type: "null",
},
],
title: "Next Dagrun Create After",
title: "Next Dagrun Run After",
},
owners: {
items: {
Expand Down Expand Up @@ -2069,10 +2069,10 @@ export const $DAGResponse = {
"max_consecutive_failed_dag_runs",
"has_task_concurrency_limits",
"has_import_errors",
"next_dagrun",
"next_dagrun_logical_date",
"next_dagrun_data_interval_start",
"next_dagrun_data_interval_end",
"next_dagrun_create_after",
"next_dagrun_run_after",
"owners",
"file_token",
],
Expand Down Expand Up @@ -2785,7 +2785,7 @@ export const $DAGWithLatestDagRunsResponse = {
type: "boolean",
title: "Has Import Errors",
},
next_dagrun: {
next_dagrun_logical_date: {
anyOf: [
{
type: "string",
Expand All @@ -2795,7 +2795,7 @@ export const $DAGWithLatestDagRunsResponse = {
type: "null",
},
],
title: "Next Dagrun",
title: "Next Dagrun Logical Date",
},
next_dagrun_data_interval_start: {
anyOf: [
Expand All @@ -2821,7 +2821,7 @@ export const $DAGWithLatestDagRunsResponse = {
],
title: "Next Dagrun Data Interval End",
},
next_dagrun_create_after: {
next_dagrun_run_after: {
anyOf: [
{
type: "string",
Expand All @@ -2831,7 +2831,7 @@ export const $DAGWithLatestDagRunsResponse = {
type: "null",
},
],
title: "Next Dagrun Create After",
title: "Next Dagrun Run After",
},
owners: {
items: {
Expand Down Expand Up @@ -2873,10 +2873,10 @@ export const $DAGWithLatestDagRunsResponse = {
"max_consecutive_failed_dag_runs",
"has_task_concurrency_limits",
"has_import_errors",
"next_dagrun",
"next_dagrun_logical_date",
"next_dagrun_data_interval_start",
"next_dagrun_data_interval_end",
"next_dagrun_create_after",
"next_dagrun_run_after",
"owners",
"latest_dag_runs",
"file_token",
Expand Down
12 changes: 6 additions & 6 deletions airflow/ui/openapi-gen/requests/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,10 @@ export type DAGDetailsResponse = {
max_consecutive_failed_dag_runs: number;
has_task_concurrency_limits: boolean;
has_import_errors: boolean;
next_dagrun: string | null;
next_dagrun_logical_date: string | null;
next_dagrun_data_interval_start: string | null;
next_dagrun_data_interval_end: string | null;
next_dagrun_create_after: string | null;
next_dagrun_run_after: string | null;
owners: Array<string>;
catchup: boolean;
dag_run_timeout: string | null;
Expand Down Expand Up @@ -535,10 +535,10 @@ export type DAGResponse = {
max_consecutive_failed_dag_runs: number;
has_task_concurrency_limits: boolean;
has_import_errors: boolean;
next_dagrun: string | null;
next_dagrun_logical_date: string | null;
next_dagrun_data_interval_start: string | null;
next_dagrun_data_interval_end: string | null;
next_dagrun_create_after: string | null;
next_dagrun_run_after: string | null;
owners: Array<string>;
/**
* Return file token.
Expand Down Expand Up @@ -710,10 +710,10 @@ export type DAGWithLatestDagRunsResponse = {
max_consecutive_failed_dag_runs: number;
has_task_concurrency_limits: boolean;
has_import_errors: boolean;
next_dagrun: string | null;
next_dagrun_logical_date: string | null;
next_dagrun_data_interval_start: string | null;
next_dagrun_data_interval_end: string | null;
next_dagrun_create_after: string | null;
next_dagrun_run_after: string | null;
owners: Array<string>;
latest_dag_runs: Array<DAGRunResponse>;
/**
Expand Down
6 changes: 3 additions & 3 deletions airflow/ui/src/pages/Dag/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ export const Header = ({
) : undefined}
</Stat>
<Stat label="Next Run">
{Boolean(dagWithRuns?.next_dagrun_create_after) ? (
{Boolean(dagWithRuns?.next_dagrun_run_after) ? (
<DagRunInfo
logicalDate={dagWithRuns?.next_dagrun}
runAfter={dagWithRuns?.next_dagrun_create_after as string}
logicalDate={dagWithRuns?.next_dagrun_logical_date}
runAfter={dagWithRuns?.next_dagrun_run_after as string}
/>
) : undefined}
</Stat>
Expand Down
4 changes: 2 additions & 2 deletions airflow/ui/src/pages/DagsList/DagCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ const mockDag = {
max_active_runs: 16,
max_active_tasks: 16,
max_consecutive_failed_dag_runs: 0,
next_dagrun: "2024-08-22T00:00:00+00:00",
next_dagrun_create_after: "2024-08-23T00:00:00+00:00",
next_dagrun_data_interval_end: "2024-08-23T00:00:00+00:00",
next_dagrun_data_interval_start: "2024-08-22T00:00:00+00:00",
next_dagrun_logical_date: "2024-08-22T00:00:00+00:00",
next_dagrun_run_after: "2024-08-23T00:00:00+00:00",
owners: ["airflow"],
tags: [],
timetable_description: "",
Expand Down
Loading
Loading