This is an automated email from the ASF dual-hosted git repository.
pierrejeambrun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 6b89a3873c5 add dag_version filter to get_dag_runs endpoint and
corresponding tests (#54882)
6b89a3873c5 is described below
commit 6b89a3873c54ef7e116e04c7e074be1efb353251
Author: Kalyan R <[email protected]>
AuthorDate: Wed Sep 3 19:15:58 2025 +0530
add dag_version filter to get_dag_runs endpoint and corresponding tests
(#54882)
---
.../src/airflow/api_fastapi/common/parameters.py | 12 +++++++++
.../core_api/openapi/v2-rest-api-generated.yaml | 8 ++++++
.../api_fastapi/core_api/routes/public/dag_run.py | 8 ++++++
.../src/airflow/ui/openapi-gen/queries/common.ts | 5 ++--
.../ui/openapi-gen/queries/ensureQueryData.ts | 6 +++--
.../src/airflow/ui/openapi-gen/queries/prefetch.ts | 6 +++--
.../src/airflow/ui/openapi-gen/queries/queries.ts | 6 +++--
.../src/airflow/ui/openapi-gen/queries/suspense.ts | 6 +++--
.../ui/openapi-gen/requests/services.gen.ts | 2 ++
.../airflow/ui/openapi-gen/requests/types.gen.ts | 1 +
.../core_api/routes/public/test_dag_run.py | 29 ++++++++++++++++++++++
11 files changed, 79 insertions(+), 10 deletions(-)
diff --git a/airflow-core/src/airflow/api_fastapi/common/parameters.py
b/airflow-core/src/airflow/api_fastapi/common/parameters.py
index ff96268a77a..23f35cb999c 100644
--- a/airflow-core/src/airflow/api_fastapi/common/parameters.py
+++ b/airflow-core/src/airflow/api_fastapi/common/parameters.py
@@ -853,6 +853,18 @@ QueryTIDagVersionFilter = Annotated[
)
),
]
+QueryDagRunVersionFilter = Annotated[
+ FilterParam[list[int]],
+ Depends(
+ filter_param_factory(
+ DagVersion.version_number,
+ list[int],
+ FilterOptionEnum.ANY_EQUAL,
+ default_factory=list,
+ filter_name="dag_version",
+ )
+ ),
+]
QueryTITryNumberFilter = Annotated[
FilterParam[list[int]],
Depends(
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 08907c2674a..aeaf57f661e 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
@@ -2191,6 +2191,14 @@ paths:
items:
type: string
title: State
+ - name: dag_version
+ in: query
+ required: false
+ schema:
+ type: array
+ items:
+ type: integer
+ title: Dag Version
- name: order_by
in: query
required: false
diff --git
a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py
b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py
index 30374d5e41a..8056c6fbda4 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py
@@ -43,6 +43,7 @@ from airflow.api_fastapi.common.parameters import (
OffsetFilter,
QueryDagRunRunTypesFilter,
QueryDagRunStateFilter,
+ QueryDagRunVersionFilter,
QueryLimit,
QueryOffset,
Range,
@@ -80,6 +81,7 @@ from airflow.api_fastapi.logging.decorators import
action_logging
from airflow.exceptions import ParamValidationError
from airflow.listeners.listener import get_listener_manager
from airflow.models import DagModel, DagRun
+from airflow.models.dag_version import DagVersion
from airflow.utils.state import DagRunState
from airflow.utils.types import DagRunTriggeredByType, DagRunType
@@ -318,6 +320,7 @@ def get_dag_runs(
update_at_range: Annotated[RangeFilter,
Depends(datetime_range_filter_factory("updated_at", DagRun))],
run_type: QueryDagRunRunTypesFilter,
state: QueryDagRunStateFilter,
+ dag_version: QueryDagRunVersionFilter,
order_by: Annotated[
SortParam,
Depends(
@@ -360,6 +363,10 @@ def get_dag_runs(
get_latest_version_of_dag(dag_bag, dag_id, session) # Check if the
DAG exists.
query = query.filter(DagRun.dag_id ==
dag_id).options(joinedload(DagRun.dag_model))
+ # Add join with DagVersion if dag_version filter is active
+ if dag_version.value:
+ query = query.join(DagVersion, DagRun.created_dag_version_id ==
DagVersion.id)
+
dag_run_select, total_entries = paginated_select(
statement=query,
filters=[
@@ -370,6 +377,7 @@ def get_dag_runs(
update_at_range,
state,
run_type,
+ dag_version,
readable_dag_runs_filter,
run_id_pattern,
triggering_user_name_pattern,
diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/common.ts
b/airflow-core/src/airflow/ui/openapi-gen/queries/common.ts
index e44d315987a..9dc12bd20dc 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/queries/common.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/queries/common.ts
@@ -142,8 +142,9 @@ export const UseDagRunServiceGetUpstreamAssetEventsKeyFn =
({ dagId, dagRunId }:
export type DagRunServiceGetDagRunsDefaultResponse = Awaited<ReturnType<typeof
DagRunService.getDagRuns>>;
export type DagRunServiceGetDagRunsQueryResult<TData =
DagRunServiceGetDagRunsDefaultResponse, TError = unknown> =
UseQueryResult<TData, TError>;
export const useDagRunServiceGetDagRunsKey = "DagRunServiceGetDagRuns";
-export const UseDagRunServiceGetDagRunsKeyFn = ({ dagId, endDateGt,
endDateGte, endDateLt, endDateLte, limit, logicalDateGt, logicalDateGte,
logicalDateLt, logicalDateLte, offset, orderBy, runAfterGt, runAfterGte,
runAfterLt, runAfterLte, runIdPattern, runType, startDateGt, startDateGte,
startDateLt, startDateLte, state, triggeringUserNamePattern, updatedAtGt,
updatedAtGte, updatedAtLt, updatedAtLte }: {
+export const UseDagRunServiceGetDagRunsKeyFn = ({ dagId, dagVersion,
endDateGt, endDateGte, endDateLt, endDateLte, limit, logicalDateGt,
logicalDateGte, logicalDateLt, logicalDateLte, offset, orderBy, runAfterGt,
runAfterGte, runAfterLt, runAfterLte, runIdPattern, runType, startDateGt,
startDateGte, startDateLt, startDateLte, state, triggeringUserNamePattern,
updatedAtGt, updatedAtGte, updatedAtLt, updatedAtLte }: {
dagId: string;
+ dagVersion?: number[];
endDateGt?: string;
endDateGte?: string;
endDateLt?: string;
@@ -171,7 +172,7 @@ export const UseDagRunServiceGetDagRunsKeyFn = ({ dagId,
endDateGt, endDateGte,
updatedAtGte?: string;
updatedAtLt?: string;
updatedAtLte?: string;
-}, queryKey?: Array<unknown>) => [useDagRunServiceGetDagRunsKey, ...(queryKey
?? [{ dagId, endDateGt, endDateGte, endDateLt, endDateLte, limit,
logicalDateGt, logicalDateGte, logicalDateLt, logicalDateLte, offset, orderBy,
runAfterGt, runAfterGte, runAfterLt, runAfterLte, runIdPattern, runType,
startDateGt, startDateGte, startDateLt, startDateLte, state,
triggeringUserNamePattern, updatedAtGt, updatedAtGte, updatedAtLt, updatedAtLte
}])];
+}, queryKey?: Array<unknown>) => [useDagRunServiceGetDagRunsKey, ...(queryKey
?? [{ dagId, dagVersion, endDateGt, endDateGte, endDateLt, endDateLte, limit,
logicalDateGt, logicalDateGte, logicalDateLt, logicalDateLte, offset, orderBy,
runAfterGt, runAfterGte, runAfterLt, runAfterLte, runIdPattern, runType,
startDateGt, startDateGte, startDateLt, startDateLte, state,
triggeringUserNamePattern, updatedAtGt, updatedAtGte, updatedAtLt, updatedAtLte
}])];
export type DagRunServiceWaitDagRunUntilFinishedDefaultResponse =
Awaited<ReturnType<typeof DagRunService.waitDagRunUntilFinished>>;
export type DagRunServiceWaitDagRunUntilFinishedQueryResult<TData =
DagRunServiceWaitDagRunUntilFinishedDefaultResponse, TError = unknown> =
UseQueryResult<TData, TError>;
export const useDagRunServiceWaitDagRunUntilFinishedKey =
"DagRunServiceWaitDagRunUntilFinished";
diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts
b/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts
index d8791a31240..ae6a52073bc 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts
@@ -285,14 +285,16 @@ export const
ensureUseDagRunServiceGetUpstreamAssetEventsData = (queryClient: Qu
* @param data.updatedAtLt
* @param data.runType
* @param data.state
+* @param data.dagVersion
* @param data.orderBy
* @param data.runIdPattern SQL LIKE expression — use `%` / `_` wildcards (e.g.
`%customer_%`). Regular expressions are **not** supported.
* @param data.triggeringUserNamePattern SQL LIKE expression — use `%` / `_`
wildcards (e.g. `%customer_%`). Regular expressions are **not** supported.
* @returns DAGRunCollectionResponse Successful Response
* @throws ApiError
*/
-export const ensureUseDagRunServiceGetDagRunsData = (queryClient: QueryClient,
{ dagId, endDateGt, endDateGte, endDateLt, endDateLte, limit, logicalDateGt,
logicalDateGte, logicalDateLt, logicalDateLte, offset, orderBy, runAfterGt,
runAfterGte, runAfterLt, runAfterLte, runIdPattern, runType, startDateGt,
startDateGte, startDateLt, startDateLte, state, triggeringUserNamePattern,
updatedAtGt, updatedAtGte, updatedAtLt, updatedAtLte }: {
+export const ensureUseDagRunServiceGetDagRunsData = (queryClient: QueryClient,
{ dagId, dagVersion, endDateGt, endDateGte, endDateLt, endDateLte, limit,
logicalDateGt, logicalDateGte, logicalDateLt, logicalDateLte, offset, orderBy,
runAfterGt, runAfterGte, runAfterLt, runAfterLte, runIdPattern, runType,
startDateGt, startDateGte, startDateLt, startDateLte, state,
triggeringUserNamePattern, updatedAtGt, updatedAtGte, updatedAtLt, updatedAtLte
}: {
dagId: string;
+ dagVersion?: number[];
endDateGt?: string;
endDateGte?: string;
endDateLt?: string;
@@ -320,7 +322,7 @@ export const ensureUseDagRunServiceGetDagRunsData =
(queryClient: QueryClient, {
updatedAtGte?: string;
updatedAtLt?: string;
updatedAtLte?: string;
-}) => queryClient.ensureQueryData({ queryKey:
Common.UseDagRunServiceGetDagRunsKeyFn({ dagId, endDateGt, endDateGte,
endDateLt, endDateLte, limit, logicalDateGt, logicalDateGte, logicalDateLt,
logicalDateLte, offset, orderBy, runAfterGt, runAfterGte, runAfterLt,
runAfterLte, runIdPattern, runType, startDateGt, startDateGte, startDateLt,
startDateLte, state, triggeringUserNamePattern, updatedAtGt, updatedAtGte,
updatedAtLt, updatedAtLte }), queryFn: () => DagRunService.getDagRuns({ dagId,
[...]
+}) => queryClient.ensureQueryData({ queryKey:
Common.UseDagRunServiceGetDagRunsKeyFn({ dagId, dagVersion, endDateGt,
endDateGte, endDateLt, endDateLte, limit, logicalDateGt, logicalDateGte,
logicalDateLt, logicalDateLte, offset, orderBy, runAfterGt, runAfterGte,
runAfterLt, runAfterLte, runIdPattern, runType, startDateGt, startDateGte,
startDateLt, startDateLte, state, triggeringUserNamePattern, updatedAtGt,
updatedAtGte, updatedAtLt, updatedAtLte }), queryFn: () =>
DagRunService.getDagR [...]
/**
* Experimental: Wait for a dag run to complete, and return task results if
requested.
* 🚧 This is an experimental endpoint and may change or be removed without
notice.
diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts
b/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts
index 2a565335946..c681eeb4fdc 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts
@@ -285,14 +285,16 @@ export const
prefetchUseDagRunServiceGetUpstreamAssetEvents = (queryClient: Quer
* @param data.updatedAtLt
* @param data.runType
* @param data.state
+* @param data.dagVersion
* @param data.orderBy
* @param data.runIdPattern SQL LIKE expression — use `%` / `_` wildcards (e.g.
`%customer_%`). Regular expressions are **not** supported.
* @param data.triggeringUserNamePattern SQL LIKE expression — use `%` / `_`
wildcards (e.g. `%customer_%`). Regular expressions are **not** supported.
* @returns DAGRunCollectionResponse Successful Response
* @throws ApiError
*/
-export const prefetchUseDagRunServiceGetDagRuns = (queryClient: QueryClient, {
dagId, endDateGt, endDateGte, endDateLt, endDateLte, limit, logicalDateGt,
logicalDateGte, logicalDateLt, logicalDateLte, offset, orderBy, runAfterGt,
runAfterGte, runAfterLt, runAfterLte, runIdPattern, runType, startDateGt,
startDateGte, startDateLt, startDateLte, state, triggeringUserNamePattern,
updatedAtGt, updatedAtGte, updatedAtLt, updatedAtLte }: {
+export const prefetchUseDagRunServiceGetDagRuns = (queryClient: QueryClient, {
dagId, dagVersion, endDateGt, endDateGte, endDateLt, endDateLte, limit,
logicalDateGt, logicalDateGte, logicalDateLt, logicalDateLte, offset, orderBy,
runAfterGt, runAfterGte, runAfterLt, runAfterLte, runIdPattern, runType,
startDateGt, startDateGte, startDateLt, startDateLte, state,
triggeringUserNamePattern, updatedAtGt, updatedAtGte, updatedAtLt, updatedAtLte
}: {
dagId: string;
+ dagVersion?: number[];
endDateGt?: string;
endDateGte?: string;
endDateLt?: string;
@@ -320,7 +322,7 @@ export const prefetchUseDagRunServiceGetDagRuns =
(queryClient: QueryClient, { d
updatedAtGte?: string;
updatedAtLt?: string;
updatedAtLte?: string;
-}) => queryClient.prefetchQuery({ queryKey:
Common.UseDagRunServiceGetDagRunsKeyFn({ dagId, endDateGt, endDateGte,
endDateLt, endDateLte, limit, logicalDateGt, logicalDateGte, logicalDateLt,
logicalDateLte, offset, orderBy, runAfterGt, runAfterGte, runAfterLt,
runAfterLte, runIdPattern, runType, startDateGt, startDateGte, startDateLt,
startDateLte, state, triggeringUserNamePattern, updatedAtGt, updatedAtGte,
updatedAtLt, updatedAtLte }), queryFn: () => DagRunService.getDagRuns({ dagId,
e [...]
+}) => queryClient.prefetchQuery({ queryKey:
Common.UseDagRunServiceGetDagRunsKeyFn({ dagId, dagVersion, endDateGt,
endDateGte, endDateLt, endDateLte, limit, logicalDateGt, logicalDateGte,
logicalDateLt, logicalDateLte, offset, orderBy, runAfterGt, runAfterGte,
runAfterLt, runAfterLte, runIdPattern, runType, startDateGt, startDateGte,
startDateLt, startDateLte, state, triggeringUserNamePattern, updatedAtGt,
updatedAtGte, updatedAtLt, updatedAtLte }), queryFn: () =>
DagRunService.getDagRun [...]
/**
* Experimental: Wait for a dag run to complete, and return task results if
requested.
* 🚧 This is an experimental endpoint and may change or be removed without
notice.
diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts
b/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts
index 5c325b48b4d..e55011531b0 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts
@@ -285,14 +285,16 @@ export const useDagRunServiceGetUpstreamAssetEvents =
<TData = Common.DagRunServ
* @param data.updatedAtLt
* @param data.runType
* @param data.state
+* @param data.dagVersion
* @param data.orderBy
* @param data.runIdPattern SQL LIKE expression — use `%` / `_` wildcards (e.g.
`%customer_%`). Regular expressions are **not** supported.
* @param data.triggeringUserNamePattern SQL LIKE expression — use `%` / `_`
wildcards (e.g. `%customer_%`). Regular expressions are **not** supported.
* @returns DAGRunCollectionResponse Successful Response
* @throws ApiError
*/
-export const useDagRunServiceGetDagRuns = <TData =
Common.DagRunServiceGetDagRunsDefaultResponse, TError = unknown, TQueryKey
extends Array<unknown> = unknown[]>({ dagId, endDateGt, endDateGte, endDateLt,
endDateLte, limit, logicalDateGt, logicalDateGte, logicalDateLt,
logicalDateLte, offset, orderBy, runAfterGt, runAfterGte, runAfterLt,
runAfterLte, runIdPattern, runType, startDateGt, startDateGte, startDateLt,
startDateLte, state, triggeringUserNamePattern, updatedAtGt, updatedAtGte, u
[...]
+export const useDagRunServiceGetDagRuns = <TData =
Common.DagRunServiceGetDagRunsDefaultResponse, TError = unknown, TQueryKey
extends Array<unknown> = unknown[]>({ dagId, dagVersion, endDateGt, endDateGte,
endDateLt, endDateLte, limit, logicalDateGt, logicalDateGte, logicalDateLt,
logicalDateLte, offset, orderBy, runAfterGt, runAfterGte, runAfterLt,
runAfterLte, runIdPattern, runType, startDateGt, startDateGte, startDateLt,
startDateLte, state, triggeringUserNamePattern, updatedAtGt, upd [...]
dagId: string;
+ dagVersion?: number[];
endDateGt?: string;
endDateGte?: string;
endDateLt?: string;
@@ -320,7 +322,7 @@ export const useDagRunServiceGetDagRuns = <TData =
Common.DagRunServiceGetDagRun
updatedAtGte?: string;
updatedAtLt?: string;
updatedAtLte?: string;
-}, queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>,
"queryKey" | "queryFn">) => useQuery<TData, TError>({ queryKey:
Common.UseDagRunServiceGetDagRunsKeyFn({ dagId, endDateGt, endDateGte,
endDateLt, endDateLte, limit, logicalDateGt, logicalDateGte, logicalDateLt,
logicalDateLte, offset, orderBy, runAfterGt, runAfterGte, runAfterLt,
runAfterLte, runIdPattern, runType, startDateGt, startDateGte, startDateLt,
startDateLte, state, triggeringUserNamePattern, updatedAtGt, up [...]
+}, queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>,
"queryKey" | "queryFn">) => useQuery<TData, TError>({ queryKey:
Common.UseDagRunServiceGetDagRunsKeyFn({ dagId, dagVersion, endDateGt,
endDateGte, endDateLt, endDateLte, limit, logicalDateGt, logicalDateGte,
logicalDateLt, logicalDateLte, offset, orderBy, runAfterGt, runAfterGte,
runAfterLt, runAfterLte, runIdPattern, runType, startDateGt, startDateGte,
startDateLt, startDateLte, state, triggeringUserNamePattern, upd [...]
/**
* Experimental: Wait for a dag run to complete, and return task results if
requested.
* 🚧 This is an experimental endpoint and may change or be removed without
notice.
diff --git a/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts
b/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts
index 71cd9fc1214..8982708376e 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts
@@ -285,14 +285,16 @@ export const
useDagRunServiceGetUpstreamAssetEventsSuspense = <TData = Common.Da
* @param data.updatedAtLt
* @param data.runType
* @param data.state
+* @param data.dagVersion
* @param data.orderBy
* @param data.runIdPattern SQL LIKE expression — use `%` / `_` wildcards (e.g.
`%customer_%`). Regular expressions are **not** supported.
* @param data.triggeringUserNamePattern SQL LIKE expression — use `%` / `_`
wildcards (e.g. `%customer_%`). Regular expressions are **not** supported.
* @returns DAGRunCollectionResponse Successful Response
* @throws ApiError
*/
-export const useDagRunServiceGetDagRunsSuspense = <TData =
Common.DagRunServiceGetDagRunsDefaultResponse, TError = unknown, TQueryKey
extends Array<unknown> = unknown[]>({ dagId, endDateGt, endDateGte, endDateLt,
endDateLte, limit, logicalDateGt, logicalDateGte, logicalDateLt,
logicalDateLte, offset, orderBy, runAfterGt, runAfterGte, runAfterLt,
runAfterLte, runIdPattern, runType, startDateGt, startDateGte, startDateLt,
startDateLte, state, triggeringUserNamePattern, updatedAtGt, updated [...]
+export const useDagRunServiceGetDagRunsSuspense = <TData =
Common.DagRunServiceGetDagRunsDefaultResponse, TError = unknown, TQueryKey
extends Array<unknown> = unknown[]>({ dagId, dagVersion, endDateGt, endDateGte,
endDateLt, endDateLte, limit, logicalDateGt, logicalDateGte, logicalDateLt,
logicalDateLte, offset, orderBy, runAfterGt, runAfterGte, runAfterLt,
runAfterLte, runIdPattern, runType, startDateGt, startDateGte, startDateLt,
startDateLte, state, triggeringUserNamePattern, updatedA [...]
dagId: string;
+ dagVersion?: number[];
endDateGt?: string;
endDateGte?: string;
endDateLt?: string;
@@ -320,7 +322,7 @@ export const useDagRunServiceGetDagRunsSuspense = <TData =
Common.DagRunServiceG
updatedAtGte?: string;
updatedAtLt?: string;
updatedAtLte?: string;
-}, queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>,
"queryKey" | "queryFn">) => useSuspenseQuery<TData, TError>({ queryKey:
Common.UseDagRunServiceGetDagRunsKeyFn({ dagId, endDateGt, endDateGte,
endDateLt, endDateLte, limit, logicalDateGt, logicalDateGte, logicalDateLt,
logicalDateLte, offset, orderBy, runAfterGt, runAfterGte, runAfterLt,
runAfterLte, runIdPattern, runType, startDateGt, startDateGte, startDateLt,
startDateLte, state, triggeringUserNamePattern, updated [...]
+}, queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>,
"queryKey" | "queryFn">) => useSuspenseQuery<TData, TError>({ queryKey:
Common.UseDagRunServiceGetDagRunsKeyFn({ dagId, dagVersion, endDateGt,
endDateGte, endDateLt, endDateLte, limit, logicalDateGt, logicalDateGte,
logicalDateLt, logicalDateLte, offset, orderBy, runAfterGt, runAfterGte,
runAfterLt, runAfterLte, runIdPattern, runType, startDateGt, startDateGte,
startDateLt, startDateLte, state, triggeringUserNamePatt [...]
/**
* Experimental: Wait for a dag run to complete, and return task results if
requested.
* 🚧 This is an experimental endpoint and may change or be removed without
notice.
diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts
b/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts
index 6190c2845f0..8a6c09b8eb4 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/requests/services.gen.ts
@@ -996,6 +996,7 @@ export class DagRunService {
* @param data.updatedAtLt
* @param data.runType
* @param data.state
+ * @param data.dagVersion
* @param data.orderBy
* @param data.runIdPattern SQL LIKE expression — use `%` / `_` wildcards
(e.g. `%customer_%`). Regular expressions are **not** supported.
* @param data.triggeringUserNamePattern SQL LIKE expression — use `%` /
`_` wildcards (e.g. `%customer_%`). Regular expressions are **not** supported.
@@ -1034,6 +1035,7 @@ export class DagRunService {
updated_at_lt: data.updatedAtLt,
run_type: data.runType,
state: data.state,
+ dag_version: data.dagVersion,
order_by: data.orderBy,
run_id_pattern: data.runIdPattern,
triggering_user_name_pattern: data.triggeringUserNamePattern
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 d5dd73c752b..414dbc8f12e 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
@@ -2230,6 +2230,7 @@ export type ClearDagRunResponse =
TaskInstanceCollectionResponse | DAGRunRespons
export type GetDagRunsData = {
dagId: string;
+ dagVersion?: Array<(number)>;
endDateGt?: string | null;
endDateGte?: string | null;
endDateLt?: string | null;
diff --git
a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_run.py
b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_run.py
index b04fed4d72c..c6069426937 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_run.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_run.py
@@ -591,6 +591,28 @@ class TestGetDagRuns:
},
[DAG1_RUN1_ID],
),
+ # Test dag_version filter
+ (
+ DAG1_ID,
+ {"dag_version": [1]},
+ [DAG1_RUN1_ID, DAG1_RUN2_ID],
+ ), # Version 1 should match all DAG1 runs
+ (
+ DAG2_ID,
+ {"dag_version": [1]},
+ [DAG2_RUN1_ID, DAG2_RUN2_ID],
+ ), # Version 1 should match all DAG2 runs
+ (
+ "~",
+ {"dag_version": [1]},
+ [DAG1_RUN1_ID, DAG1_RUN2_ID, DAG2_RUN1_ID, DAG2_RUN2_ID],
+ ), # Version 1 should match all runs
+ ("~", {"dag_version": [999]}, []), # Non-existent version should
match no runs
+ (
+ DAG1_ID,
+ {"dag_version": [1, 999]},
+ [DAG1_RUN1_ID, DAG1_RUN2_ID],
+ ), # Multiple versions, only existing ones match
],
)
@pytest.mark.usefixtures("configure_git_connection_for_dag_bundle")
@@ -681,6 +703,13 @@ class TestGetDagRuns:
response.json()["detail"] == f"Invalid value for state. Valid
values are {', '.join(DagRunState)}"
)
+ def test_invalid_dag_version(self, test_client):
+ response = test_client.get(f"/dags/{DAG1_ID}/dagRuns",
params={"dag_version": ["invalid"]})
+ assert response.status_code == 422
+ body = response.json()
+ assert body["detail"][0]["type"] == "int_parsing"
+ assert "dag_version" in body["detail"][0]["loc"]
+
class TestListDagRunsBatch:
@pytest.mark.usefixtures("configure_git_connection_for_dag_bundle")