diff --git a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/backfills.py b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/backfills.py index df1ffaca0144f..52538b37e16de 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/backfills.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/backfills.py @@ -24,7 +24,6 @@ from airflow.api_fastapi.core_api.base import BaseModel, StrictBaseModel from airflow.models.backfill import ReprocessBehavior -from airflow.utils.state import DagRunState class BackfillPostBody(StrictBaseModel): @@ -70,27 +69,6 @@ class BackfillCollectionResponse(BaseModel): total_entries: int -class BackfillDagRunResponse(BaseModel): - """Serializer for a single BackfillDagRun entry with joined DagRun state.""" - - id: NonNegativeInt - backfill_id: NonNegativeInt - dag_id: str = Field(validation_alias=AliasPath("backfill", "dag_id")) - dag_run_id: str | None = Field(default=None, validation_alias=AliasPath("dag_run", "run_id")) - logical_date: datetime | None - partition_key: str | None - sort_ordinal: int - exception_reason: str | None - dag_run_state: DagRunState | None = Field(default=None, validation_alias=AliasPath("dag_run", "state")) - - -class BackfillDagRunCollectionResponse(BaseModel): - """BackfillDagRun Collection serializer for responses.""" - - backfill_dag_runs: list[BackfillDagRunResponse] - total_entries: int - - class DryRunBackfillResponse(BaseModel): """Backfill serializer for responses in dry-run mode.""" 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 a3e8bc66faa1b..1127dfe1d2fa7 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 @@ -1157,85 +1157,6 @@ paths: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' - /api/v2/backfills/{backfill_id}/dag_runs: - get: - tags: - - Backfill - summary: List Backfill Dag Runs - description: List Dag runs associated with a backfill, including skipped slots. - operationId: list_backfill_dag_runs - security: - - OAuth2PasswordBearer: [] - - HTTPBearer: [] - parameters: - - name: backfill_id - in: path - required: true - schema: - type: integer - minimum: 0 - title: Backfill Id - - name: limit - in: query - required: false - schema: - type: integer - minimum: 0 - default: 50 - title: Limit - - name: offset - in: query - required: false - schema: - type: integer - minimum: 0 - default: 0 - title: Offset - - name: order_by - in: query - required: false - schema: - type: array - items: - type: string - description: 'Attributes to order by, multi criteria sort is supported. - Prefix with `-` for descending order. Supported attributes: `id, sort_ordinal`' - default: - - sort_ordinal - title: Order By - description: 'Attributes to order by, multi criteria sort is supported. Prefix - with `-` for descending order. Supported attributes: `id, sort_ordinal`' - responses: - '200': - description: Successful Response - content: - application/json: - schema: - $ref: '#/components/schemas/BackfillDagRunCollectionResponse' - '401': - content: - application/json: - schema: - $ref: '#/components/schemas/HTTPExceptionResponse' - description: Unauthorized - '403': - content: - application/json: - schema: - $ref: '#/components/schemas/HTTPExceptionResponse' - description: Forbidden - '404': - content: - application/json: - schema: - $ref: '#/components/schemas/HTTPExceptionResponse' - description: Not Found - '422': - description: Validation Error - content: - application/json: - schema: - $ref: '#/components/schemas/HTTPValidationError' /api/v2/backfills/{backfill_id}/pause: put: tags: @@ -11259,75 +11180,6 @@ components: - total_entries title: BackfillCollectionResponse description: Backfill Collection serializer for responses. - BackfillDagRunCollectionResponse: - properties: - backfill_dag_runs: - items: - $ref: '#/components/schemas/BackfillDagRunResponse' - type: array - title: Backfill Dag Runs - total_entries: - type: integer - title: Total Entries - type: object - required: - - backfill_dag_runs - - total_entries - title: BackfillDagRunCollectionResponse - description: BackfillDagRun Collection serializer for responses. - BackfillDagRunResponse: - properties: - id: - type: integer - minimum: 0.0 - title: Id - backfill_id: - type: integer - minimum: 0.0 - title: Backfill Id - dag_id: - type: string - title: Dag Id - dag_run_id: - anyOf: - - type: string - - type: 'null' - title: Dag Run Id - logical_date: - anyOf: - - type: string - format: date-time - - type: 'null' - title: Logical Date - partition_key: - anyOf: - - type: string - - type: 'null' - title: Partition Key - sort_ordinal: - type: integer - title: Sort Ordinal - exception_reason: - anyOf: - - type: string - - type: 'null' - title: Exception Reason - dag_run_state: - anyOf: - - $ref: '#/components/schemas/DagRunState' - - type: 'null' - type: object - required: - - id - - backfill_id - - dag_id - - logical_date - - partition_key - - sort_ordinal - - exception_reason - title: BackfillDagRunResponse - description: Serializer for a single BackfillDagRun entry with joined DagRun - state. BackfillPostBody: properties: dag_id: diff --git a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/backfills.py b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/backfills.py index 62c43616c405e..c4971b883a11b 100644 --- a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/backfills.py +++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/backfills.py @@ -35,7 +35,6 @@ from airflow.api_fastapi.common.router import AirflowRouter from airflow.api_fastapi.core_api.datamodels.backfills import ( BackfillCollectionResponse, - BackfillDagRunCollectionResponse, BackfillPostBody, BackfillResponse, DryRunBackfillCollectionResponse, @@ -129,44 +128,6 @@ def get_backfill( raise HTTPException(status.HTTP_404_NOT_FOUND, "Backfill not found") -@backfills_router.get( - path="/{backfill_id}/dag_runs", - responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), - dependencies=[ - Depends(requires_access_backfill(method="GET")), - ], -) -def list_backfill_dag_runs( - backfill_id: NonNegativeInt, - limit: QueryLimit, - offset: QueryOffset, - order_by: Annotated[ - SortParam, - Depends(SortParam(["id", "sort_ordinal"], BackfillDagRun).dynamic_depends(default="sort_ordinal")), - ], - session: SessionDep, -) -> BackfillDagRunCollectionResponse: - """List Dag runs associated with a backfill, including skipped slots.""" - backfill = session.get(Backfill, backfill_id) - if not backfill: - raise HTTPException(status.HTTP_404_NOT_FOUND, f"Backfill with id {backfill_id} not found") - - select_stmt, total_entries = paginated_select( - statement=select(BackfillDagRun) - .where(BackfillDagRun.backfill_id == backfill_id) - # Load backfill for dag_id; dag_run may be null for skipped slots. - .options(joinedload(BackfillDagRun.backfill), joinedload(BackfillDagRun.dag_run)), - order_by=order_by, - offset=offset, - limit=limit, - session=session, - ) - return BackfillDagRunCollectionResponse( - backfill_dag_runs=list(session.scalars(select_stmt).unique()), - total_entries=total_entries, - ) - - @backfills_router.put( path="/{backfill_id}/pause", responses=create_openapi_http_exception_doc( 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 eb45a01065f5a..8025308d4a91c 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/queries/common.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/queries/common.ts @@ -101,15 +101,6 @@ export const useBackfillServiceGetBackfillKey = "BackfillServiceGetBackfill"; export const UseBackfillServiceGetBackfillKeyFn = ({ backfillId }: { backfillId: number; }, queryKey?: Array) => [useBackfillServiceGetBackfillKey, ...(queryKey ?? [{ backfillId }])]; -export type BackfillServiceListBackfillDagRunsDefaultResponse = Awaited>; -export type BackfillServiceListBackfillDagRunsQueryResult = UseQueryResult; -export const useBackfillServiceListBackfillDagRunsKey = "BackfillServiceListBackfillDagRuns"; -export const UseBackfillServiceListBackfillDagRunsKeyFn = ({ backfillId, limit, offset, orderBy }: { - backfillId: number; - limit?: number; - offset?: number; - orderBy?: string[]; -}, queryKey?: Array) => [useBackfillServiceListBackfillDagRunsKey, ...(queryKey ?? [{ backfillId, limit, offset, orderBy }])]; export type BackfillServiceListBackfillsUiDefaultResponse = Awaited>; export type BackfillServiceListBackfillsUiQueryResult = UseQueryResult; export const useBackfillServiceListBackfillsUiKey = "BackfillServiceListBackfillsUi"; 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 230bc8340fa28..db25fda626d45 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts @@ -187,23 +187,6 @@ export const ensureUseBackfillServiceGetBackfillData = (queryClient: QueryClient backfillId: number; }) => queryClient.ensureQueryData({ queryKey: Common.UseBackfillServiceGetBackfillKeyFn({ backfillId }), queryFn: () => BackfillService.getBackfill({ backfillId }) }); /** -* List Backfill Dag Runs -* List Dag runs associated with a backfill, including skipped slots. -* @param data The data for the request. -* @param data.backfillId -* @param data.limit -* @param data.offset -* @param data.orderBy Attributes to order by, multi criteria sort is supported. Prefix with `-` for descending order. Supported attributes: `id, sort_ordinal` -* @returns BackfillDagRunCollectionResponse Successful Response -* @throws ApiError -*/ -export const ensureUseBackfillServiceListBackfillDagRunsData = (queryClient: QueryClient, { backfillId, limit, offset, orderBy }: { - backfillId: number; - limit?: number; - offset?: number; - orderBy?: string[]; -}) => queryClient.ensureQueryData({ queryKey: Common.UseBackfillServiceListBackfillDagRunsKeyFn({ backfillId, limit, offset, orderBy }), queryFn: () => BackfillService.listBackfillDagRuns({ backfillId, limit, offset, orderBy }) }); -/** * List Backfills Ui * @param data The data for the request. * @param data.limit 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 38d37e4a5cc5c..e9ec495d75d11 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts @@ -187,23 +187,6 @@ export const prefetchUseBackfillServiceGetBackfill = (queryClient: QueryClient, backfillId: number; }) => queryClient.prefetchQuery({ queryKey: Common.UseBackfillServiceGetBackfillKeyFn({ backfillId }), queryFn: () => BackfillService.getBackfill({ backfillId }) }); /** -* List Backfill Dag Runs -* List Dag runs associated with a backfill, including skipped slots. -* @param data The data for the request. -* @param data.backfillId -* @param data.limit -* @param data.offset -* @param data.orderBy Attributes to order by, multi criteria sort is supported. Prefix with `-` for descending order. Supported attributes: `id, sort_ordinal` -* @returns BackfillDagRunCollectionResponse Successful Response -* @throws ApiError -*/ -export const prefetchUseBackfillServiceListBackfillDagRuns = (queryClient: QueryClient, { backfillId, limit, offset, orderBy }: { - backfillId: number; - limit?: number; - offset?: number; - orderBy?: string[]; -}) => queryClient.prefetchQuery({ queryKey: Common.UseBackfillServiceListBackfillDagRunsKeyFn({ backfillId, limit, offset, orderBy }), queryFn: () => BackfillService.listBackfillDagRuns({ backfillId, limit, offset, orderBy }) }); -/** * List Backfills Ui * @param data The data for the request. * @param data.limit 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 336bb8516eeee..3c5033eb00ec9 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts @@ -187,23 +187,6 @@ export const useBackfillServiceGetBackfill = , "queryKey" | "queryFn">) => useQuery({ queryKey: Common.UseBackfillServiceGetBackfillKeyFn({ backfillId }, queryKey), queryFn: () => BackfillService.getBackfill({ backfillId }) as TData, ...options }); /** -* List Backfill Dag Runs -* List Dag runs associated with a backfill, including skipped slots. -* @param data The data for the request. -* @param data.backfillId -* @param data.limit -* @param data.offset -* @param data.orderBy Attributes to order by, multi criteria sort is supported. Prefix with `-` for descending order. Supported attributes: `id, sort_ordinal` -* @returns BackfillDagRunCollectionResponse Successful Response -* @throws ApiError -*/ -export const useBackfillServiceListBackfillDagRuns = = unknown[]>({ backfillId, limit, offset, orderBy }: { - backfillId: number; - limit?: number; - offset?: number; - orderBy?: string[]; -}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useQuery({ queryKey: Common.UseBackfillServiceListBackfillDagRunsKeyFn({ backfillId, limit, offset, orderBy }, queryKey), queryFn: () => BackfillService.listBackfillDagRuns({ backfillId, limit, offset, orderBy }) as TData, ...options }); -/** * List Backfills Ui * @param data The data for the request. * @param data.limit 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 00e04931bebae..03dcea8e7ef71 100644 --- a/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts +++ b/airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts @@ -187,23 +187,6 @@ export const useBackfillServiceGetBackfillSuspense = , "queryKey" | "queryFn">) => useSuspenseQuery({ queryKey: Common.UseBackfillServiceGetBackfillKeyFn({ backfillId }, queryKey), queryFn: () => BackfillService.getBackfill({ backfillId }) as TData, ...options }); /** -* List Backfill Dag Runs -* List Dag runs associated with a backfill, including skipped slots. -* @param data The data for the request. -* @param data.backfillId -* @param data.limit -* @param data.offset -* @param data.orderBy Attributes to order by, multi criteria sort is supported. Prefix with `-` for descending order. Supported attributes: `id, sort_ordinal` -* @returns BackfillDagRunCollectionResponse Successful Response -* @throws ApiError -*/ -export const useBackfillServiceListBackfillDagRunsSuspense = = unknown[]>({ backfillId, limit, offset, orderBy }: { - backfillId: number; - limit?: number; - offset?: number; - orderBy?: string[]; -}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">) => useSuspenseQuery({ queryKey: Common.UseBackfillServiceListBackfillDagRunsKeyFn({ backfillId, limit, offset, orderBy }, queryKey), queryFn: () => BackfillService.listBackfillDagRuns({ backfillId, limit, offset, orderBy }) as TData, ...options }); -/** * List Backfills Ui * @param data The data for the request. * @param data.limit 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 8d51a2868277c..cc6b03a221529 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 @@ -619,108 +619,6 @@ export const $BackfillCollectionResponse = { description: 'Backfill Collection serializer for responses.' } as const; -export const $BackfillDagRunCollectionResponse = { - properties: { - backfill_dag_runs: { - items: { - '$ref': '#/components/schemas/BackfillDagRunResponse' - }, - type: 'array', - title: 'Backfill Dag Runs' - }, - total_entries: { - type: 'integer', - title: 'Total Entries' - } - }, - type: 'object', - required: ['backfill_dag_runs', 'total_entries'], - title: 'BackfillDagRunCollectionResponse', - description: 'BackfillDagRun Collection serializer for responses.' -} as const; - -export const $BackfillDagRunResponse = { - properties: { - id: { - type: 'integer', - minimum: 0, - title: 'Id' - }, - backfill_id: { - type: 'integer', - minimum: 0, - title: 'Backfill Id' - }, - dag_id: { - type: 'string', - title: 'Dag Id' - }, - dag_run_id: { - anyOf: [ - { - type: 'string' - }, - { - type: 'null' - } - ], - title: 'Dag Run Id' - }, - logical_date: { - anyOf: [ - { - type: 'string', - format: 'date-time' - }, - { - type: 'null' - } - ], - title: 'Logical Date' - }, - partition_key: { - anyOf: [ - { - type: 'string' - }, - { - type: 'null' - } - ], - title: 'Partition Key' - }, - sort_ordinal: { - type: 'integer', - title: 'Sort Ordinal' - }, - exception_reason: { - anyOf: [ - { - type: 'string' - }, - { - type: 'null' - } - ], - title: 'Exception Reason' - }, - dag_run_state: { - anyOf: [ - { - '$ref': '#/components/schemas/DagRunState' - }, - { - type: 'null' - } - ] - } - }, - type: 'object', - required: ['id', 'backfill_id', 'dag_id', 'logical_date', 'partition_key', 'sort_ordinal', 'exception_reason'], - title: 'BackfillDagRunResponse', - description: 'Serializer for a single BackfillDagRun entry with joined DagRun state.' -} as const; - export const $BackfillPostBody = { properties: { dag_id: { 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 bbb5cfb65ef01..bbc2440925fed 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 @@ -3,7 +3,7 @@ import type { CancelablePromise } from './core/CancelablePromise'; import { OpenAPI } from './core/OpenAPI'; import { request as __request } from './core/request'; -import type { GetAssetsData, GetAssetsResponse, GetAssetAliasesData, GetAssetAliasesResponse, GetAssetAliasData, GetAssetAliasResponse, GetAssetEventsData, GetAssetEventsResponse, CreateAssetEventData, CreateAssetEventResponse, MaterializeAssetData, MaterializeAssetResponse, GetAssetQueuedEventsData, GetAssetQueuedEventsResponse, DeleteAssetQueuedEventsData, DeleteAssetQueuedEventsResponse, GetAssetData, GetAssetResponse, GetDagAssetQueuedEventsData, GetDagAssetQueuedEventsResponse, DeleteDagAssetQueuedEventsData, DeleteDagAssetQueuedEventsResponse, GetDagAssetQueuedEventData, GetDagAssetQueuedEventResponse, DeleteDagAssetQueuedEventData, DeleteDagAssetQueuedEventResponse, NextRunAssetsData, NextRunAssetsResponse2, ListBackfillsData, ListBackfillsResponse, CreateBackfillData, CreateBackfillResponse, GetBackfillData, GetBackfillResponse, ListBackfillDagRunsData, ListBackfillDagRunsResponse, PauseBackfillData, PauseBackfillResponse, UnpauseBackfillData, UnpauseBackfillResponse, CancelBackfillData, CancelBackfillResponse, CreateBackfillDryRunData, CreateBackfillDryRunResponse, ListBackfillsUiData, ListBackfillsUiResponse, DeleteConnectionData, DeleteConnectionResponse, GetConnectionData, GetConnectionResponse, PatchConnectionData, PatchConnectionResponse, GetConnectionTestData, GetConnectionTestResponse, EnqueueConnectionTestData, EnqueueConnectionTestResponse, GetConnectionsData, GetConnectionsResponse, PostConnectionData, PostConnectionResponse, BulkConnectionsData, BulkConnectionsResponse, TestConnectionData, TestConnectionResponse, CreateDefaultConnectionsResponse, HookMetaDataResponse, GetDagRunData, GetDagRunResponse, DeleteDagRunData, DeleteDagRunResponse, PatchDagRunData, PatchDagRunResponse, BulkDagRunsData, BulkDagRunsResponse, GetDagRunsData, GetDagRunsResponse, TriggerDagRunData, TriggerDagRunResponse, GetUpstreamAssetEventsData, GetUpstreamAssetEventsResponse, ClearDagRunData, ClearDagRunResponse, WaitDagRunUntilFinishedData, WaitDagRunUntilFinishedResponse, GetListDagRunsBatchData, GetListDagRunsBatchResponse, ClearDagRunsData, ClearDagRunsResponse, ClearDagRunPartitionsData, ClearDagRunPartitionsResponse, GetDagRunStatsData, GetDagRunStatsResponse, GetDagSourceData, GetDagSourceResponse, GetDagStatsData, GetDagStatsResponse, GetConfigData, GetConfigResponse, GetConfigValueData, GetConfigValueResponse, GetConfigsResponse, ListDagWarningsData, ListDagWarningsResponse, GetDagsData, GetDagsResponse, PatchDagsData, PatchDagsResponse, GetDagData, GetDagResponse, PatchDagData, PatchDagResponse, DeleteDagData, DeleteDagResponse, GetDagDetailsData, GetDagDetailsResponse, FavoriteDagData, FavoriteDagResponse, UnfavoriteDagData, UnfavoriteDagResponse, GetDagTagsData, GetDagTagsResponse, GetDagsUiData, GetDagsUiResponse, GetLatestRunInfoData, GetLatestRunInfoResponse, GetEventLogData, GetEventLogResponse, GetEventLogsData, GetEventLogsResponse, GetExtraLinksData, GetExtraLinksResponse, GetTaskInstanceData, GetTaskInstanceResponse, PatchTaskInstanceData, PatchTaskInstanceResponse, DeleteTaskInstanceData, DeleteTaskInstanceResponse, GetMappedTaskInstancesData, GetMappedTaskInstancesResponse, GetTaskInstanceDependenciesByMapIndexData, GetTaskInstanceDependenciesByMapIndexResponse, GetTaskInstanceDependenciesData, GetTaskInstanceDependenciesResponse, GetTaskInstanceTriesData, GetTaskInstanceTriesResponse, GetMappedTaskInstanceTriesData, GetMappedTaskInstanceTriesResponse, GetMappedTaskInstanceData, GetMappedTaskInstanceResponse, PatchTaskInstanceByMapIndexData, PatchTaskInstanceByMapIndexResponse, GetTaskInstancesData, GetTaskInstancesResponse, BulkTaskInstancesData, BulkTaskInstancesResponse, GetTaskInstancesBatchData, GetTaskInstancesBatchResponse, GetTaskInstanceTryDetailsData, GetTaskInstanceTryDetailsResponse, GetMappedTaskInstanceTryDetailsData, GetMappedTaskInstanceTryDetailsResponse, PostClearTaskInstancesData, PostClearTaskInstancesResponse, PatchTaskGroupInstancesData, PatchTaskGroupInstancesResponse, PatchTaskGroupInstancesDryRunData, PatchTaskGroupInstancesDryRunResponse, PatchTaskInstanceDryRunByMapIndexData, PatchTaskInstanceDryRunByMapIndexResponse, PatchTaskInstanceDryRunData, PatchTaskInstanceDryRunResponse, GetLogData, GetLogResponse, GetExternalLogUrlData, GetExternalLogUrlResponse, UpdateHitlDetailData, UpdateHitlDetailResponse, GetHitlDetailData, GetHitlDetailResponse, GetHitlDetailTryDetailData, GetHitlDetailTryDetailResponse, GetHitlDetailsData, GetHitlDetailsResponse, GetImportErrorData, GetImportErrorResponse, GetImportErrorsData, GetImportErrorsResponse, GetJobsData, GetJobsResponse, GetPluginsData, GetPluginsResponse, ImportErrorsResponse, DeletePoolData, DeletePoolResponse, GetPoolData, GetPoolResponse, PatchPoolData, PatchPoolResponse, GetPoolsData, GetPoolsResponse, PostPoolData, PostPoolResponse, BulkPoolsData, BulkPoolsResponse, GetProvidersData, GetProvidersResponse, ListAssetStateStoreData, ListAssetStateStoreResponse, ClearAssetStateStoreData, ClearAssetStateStoreResponse, GetAssetStateStoreData, GetAssetStateStoreResponse, SetAssetStateStoreData, SetAssetStateStoreResponse, DeleteAssetStateStoreData, DeleteAssetStateStoreResponse, ListTaskStateStoreData, ListTaskStateStoreResponse, ClearTaskStateStoreData, ClearTaskStateStoreResponse, GetTaskStateStoreData, GetTaskStateStoreResponse, SetTaskStateStoreData, SetTaskStateStoreResponse, PatchTaskStateStoreData, PatchTaskStateStoreResponse, DeleteTaskStateStoreData, DeleteTaskStateStoreResponse, GetXcomEntryData, GetXcomEntryResponse, UpdateXcomEntryData, UpdateXcomEntryResponse, DeleteXcomEntryData, DeleteXcomEntryResponse, GetXcomEntriesData, GetXcomEntriesResponse, CreateXcomEntryData, CreateXcomEntryResponse, GetTasksData, GetTasksResponse, GetTaskData, GetTaskResponse, DeleteVariableData, DeleteVariableResponse, GetVariableData, GetVariableResponse, PatchVariableData, PatchVariableResponse, GetVariablesData, GetVariablesResponse, PostVariableData, PostVariableResponse, BulkVariablesData, BulkVariablesResponse, ReparseDagFileData, ReparseDagFileResponse, GetDagVersionData, GetDagVersionResponse, GetDagVersionsData, GetDagVersionsResponse, GetHealthResponse, GetVersionResponse, LoginData, LoginResponse, LogoutResponse, GetAuthMenusResponse, GetCurrentUserInfoResponse, GenerateTokenData, GenerateTokenResponse2, GetPartitionedDagRunsData, GetPartitionedDagRunsResponse, GetPendingPartitionedDagRunData, GetPendingPartitionedDagRunResponse, GetDependenciesData, GetDependenciesResponse, HistoricalMetricsData, HistoricalMetricsResponse, DagStatsResponse2, GetDeadlinesData, GetDeadlinesResponse, GetDagDeadlineAlertsData, GetDagDeadlineAlertsResponse, StructureDataData, StructureDataResponse2, GetDagStructureData, GetDagStructureResponse, GetGridRunsData, GetGridRunsResponse, GetGridTiSummariesStreamData, GetGridTiSummariesStreamResponse, GetGanttDataData, GetGanttDataResponse, GetCalendarData, GetCalendarResponse, ListTeamsData, ListTeamsResponse } from './types.gen'; +import type { GetAssetsData, GetAssetsResponse, GetAssetAliasesData, GetAssetAliasesResponse, GetAssetAliasData, GetAssetAliasResponse, GetAssetEventsData, GetAssetEventsResponse, CreateAssetEventData, CreateAssetEventResponse, MaterializeAssetData, MaterializeAssetResponse, GetAssetQueuedEventsData, GetAssetQueuedEventsResponse, DeleteAssetQueuedEventsData, DeleteAssetQueuedEventsResponse, GetAssetData, GetAssetResponse, GetDagAssetQueuedEventsData, GetDagAssetQueuedEventsResponse, DeleteDagAssetQueuedEventsData, DeleteDagAssetQueuedEventsResponse, GetDagAssetQueuedEventData, GetDagAssetQueuedEventResponse, DeleteDagAssetQueuedEventData, DeleteDagAssetQueuedEventResponse, NextRunAssetsData, NextRunAssetsResponse2, ListBackfillsData, ListBackfillsResponse, CreateBackfillData, CreateBackfillResponse, GetBackfillData, GetBackfillResponse, PauseBackfillData, PauseBackfillResponse, UnpauseBackfillData, UnpauseBackfillResponse, CancelBackfillData, CancelBackfillResponse, CreateBackfillDryRunData, CreateBackfillDryRunResponse, ListBackfillsUiData, ListBackfillsUiResponse, DeleteConnectionData, DeleteConnectionResponse, GetConnectionData, GetConnectionResponse, PatchConnectionData, PatchConnectionResponse, GetConnectionTestData, GetConnectionTestResponse, EnqueueConnectionTestData, EnqueueConnectionTestResponse, GetConnectionsData, GetConnectionsResponse, PostConnectionData, PostConnectionResponse, BulkConnectionsData, BulkConnectionsResponse, TestConnectionData, TestConnectionResponse, CreateDefaultConnectionsResponse, HookMetaDataResponse, GetDagRunData, GetDagRunResponse, DeleteDagRunData, DeleteDagRunResponse, PatchDagRunData, PatchDagRunResponse, BulkDagRunsData, BulkDagRunsResponse, GetDagRunsData, GetDagRunsResponse, TriggerDagRunData, TriggerDagRunResponse, GetUpstreamAssetEventsData, GetUpstreamAssetEventsResponse, ClearDagRunData, ClearDagRunResponse, WaitDagRunUntilFinishedData, WaitDagRunUntilFinishedResponse, GetListDagRunsBatchData, GetListDagRunsBatchResponse, ClearDagRunsData, ClearDagRunsResponse, ClearDagRunPartitionsData, ClearDagRunPartitionsResponse, GetDagRunStatsData, GetDagRunStatsResponse, GetDagSourceData, GetDagSourceResponse, GetDagStatsData, GetDagStatsResponse, GetConfigData, GetConfigResponse, GetConfigValueData, GetConfigValueResponse, GetConfigsResponse, ListDagWarningsData, ListDagWarningsResponse, GetDagsData, GetDagsResponse, PatchDagsData, PatchDagsResponse, GetDagData, GetDagResponse, PatchDagData, PatchDagResponse, DeleteDagData, DeleteDagResponse, GetDagDetailsData, GetDagDetailsResponse, FavoriteDagData, FavoriteDagResponse, UnfavoriteDagData, UnfavoriteDagResponse, GetDagTagsData, GetDagTagsResponse, GetDagsUiData, GetDagsUiResponse, GetLatestRunInfoData, GetLatestRunInfoResponse, GetEventLogData, GetEventLogResponse, GetEventLogsData, GetEventLogsResponse, GetExtraLinksData, GetExtraLinksResponse, GetTaskInstanceData, GetTaskInstanceResponse, PatchTaskInstanceData, PatchTaskInstanceResponse, DeleteTaskInstanceData, DeleteTaskInstanceResponse, GetMappedTaskInstancesData, GetMappedTaskInstancesResponse, GetTaskInstanceDependenciesByMapIndexData, GetTaskInstanceDependenciesByMapIndexResponse, GetTaskInstanceDependenciesData, GetTaskInstanceDependenciesResponse, GetTaskInstanceTriesData, GetTaskInstanceTriesResponse, GetMappedTaskInstanceTriesData, GetMappedTaskInstanceTriesResponse, GetMappedTaskInstanceData, GetMappedTaskInstanceResponse, PatchTaskInstanceByMapIndexData, PatchTaskInstanceByMapIndexResponse, GetTaskInstancesData, GetTaskInstancesResponse, BulkTaskInstancesData, BulkTaskInstancesResponse, GetTaskInstancesBatchData, GetTaskInstancesBatchResponse, GetTaskInstanceTryDetailsData, GetTaskInstanceTryDetailsResponse, GetMappedTaskInstanceTryDetailsData, GetMappedTaskInstanceTryDetailsResponse, PostClearTaskInstancesData, PostClearTaskInstancesResponse, PatchTaskGroupInstancesData, PatchTaskGroupInstancesResponse, PatchTaskGroupInstancesDryRunData, PatchTaskGroupInstancesDryRunResponse, PatchTaskInstanceDryRunByMapIndexData, PatchTaskInstanceDryRunByMapIndexResponse, PatchTaskInstanceDryRunData, PatchTaskInstanceDryRunResponse, GetLogData, GetLogResponse, GetExternalLogUrlData, GetExternalLogUrlResponse, UpdateHitlDetailData, UpdateHitlDetailResponse, GetHitlDetailData, GetHitlDetailResponse, GetHitlDetailTryDetailData, GetHitlDetailTryDetailResponse, GetHitlDetailsData, GetHitlDetailsResponse, GetImportErrorData, GetImportErrorResponse, GetImportErrorsData, GetImportErrorsResponse, GetJobsData, GetJobsResponse, GetPluginsData, GetPluginsResponse, ImportErrorsResponse, DeletePoolData, DeletePoolResponse, GetPoolData, GetPoolResponse, PatchPoolData, PatchPoolResponse, GetPoolsData, GetPoolsResponse, PostPoolData, PostPoolResponse, BulkPoolsData, BulkPoolsResponse, GetProvidersData, GetProvidersResponse, ListAssetStateStoreData, ListAssetStateStoreResponse, ClearAssetStateStoreData, ClearAssetStateStoreResponse, GetAssetStateStoreData, GetAssetStateStoreResponse, SetAssetStateStoreData, SetAssetStateStoreResponse, DeleteAssetStateStoreData, DeleteAssetStateStoreResponse, ListTaskStateStoreData, ListTaskStateStoreResponse, ClearTaskStateStoreData, ClearTaskStateStoreResponse, GetTaskStateStoreData, GetTaskStateStoreResponse, SetTaskStateStoreData, SetTaskStateStoreResponse, PatchTaskStateStoreData, PatchTaskStateStoreResponse, DeleteTaskStateStoreData, DeleteTaskStateStoreResponse, GetXcomEntryData, GetXcomEntryResponse, UpdateXcomEntryData, UpdateXcomEntryResponse, DeleteXcomEntryData, DeleteXcomEntryResponse, GetXcomEntriesData, GetXcomEntriesResponse, CreateXcomEntryData, CreateXcomEntryResponse, GetTasksData, GetTasksResponse, GetTaskData, GetTaskResponse, DeleteVariableData, DeleteVariableResponse, GetVariableData, GetVariableResponse, PatchVariableData, PatchVariableResponse, GetVariablesData, GetVariablesResponse, PostVariableData, PostVariableResponse, BulkVariablesData, BulkVariablesResponse, ReparseDagFileData, ReparseDagFileResponse, GetDagVersionData, GetDagVersionResponse, GetDagVersionsData, GetDagVersionsResponse, GetHealthResponse, GetVersionResponse, LoginData, LoginResponse, LogoutResponse, GetAuthMenusResponse, GetCurrentUserInfoResponse, GenerateTokenData, GenerateTokenResponse2, GetPartitionedDagRunsData, GetPartitionedDagRunsResponse, GetPendingPartitionedDagRunData, GetPendingPartitionedDagRunResponse, GetDependenciesData, GetDependenciesResponse, HistoricalMetricsData, HistoricalMetricsResponse, DagStatsResponse2, GetDeadlinesData, GetDeadlinesResponse, GetDagDeadlineAlertsData, GetDagDeadlineAlertsResponse, StructureDataData, StructureDataResponse2, GetDagStructureData, GetDagStructureResponse, GetGridRunsData, GetGridRunsResponse, GetGridTiSummariesStreamData, GetGridTiSummariesStreamResponse, GetGanttDataData, GetGanttDataResponse, GetCalendarData, GetCalendarResponse, ListTeamsData, ListTeamsResponse } from './types.gen'; export class AssetService { /** @@ -498,38 +498,6 @@ export class BackfillService { }); } - /** - * List Backfill Dag Runs - * List Dag runs associated with a backfill, including skipped slots. - * @param data The data for the request. - * @param data.backfillId - * @param data.limit - * @param data.offset - * @param data.orderBy Attributes to order by, multi criteria sort is supported. Prefix with `-` for descending order. Supported attributes: `id, sort_ordinal` - * @returns BackfillDagRunCollectionResponse Successful Response - * @throws ApiError - */ - public static listBackfillDagRuns(data: ListBackfillDagRunsData): CancelablePromise { - return __request(OpenAPI, { - method: 'GET', - url: '/api/v2/backfills/{backfill_id}/dag_runs', - path: { - backfill_id: data.backfillId - }, - query: { - limit: data.limit, - offset: data.offset, - order_by: data.orderBy - }, - errors: { - 401: 'Unauthorized', - 403: 'Forbidden', - 404: 'Not Found', - 422: 'Validation Error' - } - }); - } - /** * Pause Backfill * @param data The data for the request. 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 be10ca6ccc17c..0259b8b0c5fb3 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 @@ -177,29 +177,6 @@ export type BackfillCollectionResponse = { total_entries: number; }; -/** - * BackfillDagRun Collection serializer for responses. - */ -export type BackfillDagRunCollectionResponse = { - backfill_dag_runs: Array; - total_entries: number; -}; - -/** - * Serializer for a single BackfillDagRun entry with joined DagRun state. - */ -export type BackfillDagRunResponse = { - id: number; - backfill_id: number; - dag_id: string; - dag_run_id?: string | null; - logical_date: string | null; - partition_key: string | null; - sort_ordinal: number; - exception_reason: string | null; - dag_run_state?: DagRunState | null; -}; - /** * Object used for create backfill request. */ @@ -2905,18 +2882,6 @@ export type GetBackfillData = { export type GetBackfillResponse = BackfillResponse; -export type ListBackfillDagRunsData = { - backfillId: number; - limit?: number; - offset?: number; - /** - * Attributes to order by, multi criteria sort is supported. Prefix with `-` for descending order. Supported attributes: `id, sort_ordinal` - */ - orderBy?: Array<(string)>; -}; - -export type ListBackfillDagRunsResponse = BackfillDagRunCollectionResponse; - export type PauseBackfillData = { backfillId: number; }; @@ -5064,33 +5029,6 @@ export type $OpenApiTs = { }; }; }; - '/api/v2/backfills/{backfill_id}/dag_runs': { - get: { - req: ListBackfillDagRunsData; - res: { - /** - * Successful Response - */ - 200: BackfillDagRunCollectionResponse; - /** - * Unauthorized - */ - 401: HTTPExceptionResponse; - /** - * Forbidden - */ - 403: HTTPExceptionResponse; - /** - * Not Found - */ - 404: HTTPExceptionResponse; - /** - * Validation Error - */ - 422: HTTPValidationError; - }; - }; - }; '/api/v2/backfills/{backfill_id}/pause': { put: { req: PauseBackfillData; diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py index a8afb9612d64e..d0fdd77e764b6 100644 --- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py +++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_backfills.py @@ -215,173 +215,6 @@ def test_invalid_id(self, test_client): ) -class TestListBackfillDagRuns(TestBackfillEndpoint): - def test_list_backfill_dag_runs(self, test_client, session): - """Happy path: backfill with mixed dag run states.""" - (dag,) = self._create_dag_models() - from_date = pendulum.parse("2024-01-01") - to_date = pendulum.parse("2024-01-03") - b = Backfill(dag_id=dag.dag_id, from_date=from_date, to_date=to_date) - session.add(b) - session.flush() - - dr1 = DagRun( - dag_id=dag.dag_id, - run_id="backfill__2024-01-01", - logical_date=pendulum.parse("2024-01-01"), - state=DagRunState.SUCCESS, - run_type="scheduled", - ) - dr2 = DagRun( - dag_id=dag.dag_id, - run_id="backfill__2024-01-02", - logical_date=pendulum.parse("2024-01-02"), - state=DagRunState.FAILED, - run_type="scheduled", - ) - session.add_all([dr1, dr2]) - session.flush() - - bdr1 = BackfillDagRun( - backfill_id=b.id, dag_run_id=dr1.id, logical_date=pendulum.parse("2024-01-01"), sort_ordinal=1 - ) - bdr2 = BackfillDagRun( - backfill_id=b.id, dag_run_id=dr2.id, logical_date=pendulum.parse("2024-01-02"), sort_ordinal=2 - ) - session.add_all([bdr1, bdr2]) - session.commit() - - response = test_client.get(f"/backfills/{b.id}/dag_runs") - assert response.status_code == 200 - data = response.json() - assert data["total_entries"] == 2 - runs = data["backfill_dag_runs"] - assert len(runs) == 2 - assert runs[0]["sort_ordinal"] == 1 - assert runs[0]["dag_id"] == dag.dag_id - assert runs[0]["dag_run_id"] == "backfill__2024-01-01" - assert runs[0]["dag_run_state"] == "success" - assert runs[1]["sort_ordinal"] == 2 - assert runs[1]["dag_id"] == dag.dag_id - assert runs[1]["dag_run_id"] == "backfill__2024-01-02" - assert runs[1]["dag_run_state"] == "failed" - - def test_list_backfill_dag_runs_with_skipped_slots(self, test_client, session): - """Slots skipped due to existing runs have null dag_run_id and exception_reason set.""" - (dag,) = self._create_dag_models() - b = Backfill( - dag_id=dag.dag_id, from_date=pendulum.parse("2024-01-01"), to_date=pendulum.parse("2024-01-02") - ) - session.add(b) - session.flush() - - bdr = BackfillDagRun( - backfill_id=b.id, - dag_run_id=None, - logical_date=pendulum.parse("2024-01-01"), - sort_ordinal=1, - exception_reason="already exists", - ) - session.add(bdr) - session.commit() - - response = test_client.get(f"/backfills/{b.id}/dag_runs") - assert response.status_code == 200 - data = response.json() - assert data["total_entries"] == 1 - run = data["backfill_dag_runs"][0] - assert run["dag_id"] == dag.dag_id - assert run["dag_run_id"] is None - assert run["dag_run_state"] is None - assert run["exception_reason"] == "already exists" - - def test_list_backfill_dag_runs_not_found(self, test_client): - """Non-existent backfill returns 404.""" - response = test_client.get("/backfills/999999/dag_runs") - assert response.status_code == 404 - - def test_list_backfill_dag_runs_pagination(self, test_client, session): - """Limit and offset work correctly.""" - (dag,) = self._create_dag_models() - b = Backfill( - dag_id=dag.dag_id, from_date=pendulum.parse("2024-01-01"), to_date=pendulum.parse("2024-01-05") - ) - session.add(b) - session.flush() - - for i in range(1, 4): - session.add( - BackfillDagRun( - backfill_id=b.id, - dag_run_id=None, - logical_date=pendulum.parse(f"2024-01-0{i}"), - sort_ordinal=i, - exception_reason="already exists", - ) - ) - session.commit() - - response = test_client.get(f"/backfills/{b.id}/dag_runs?limit=2&offset=0") - assert response.status_code == 200 - data = response.json() - assert data["total_entries"] == 3 - assert len(data["backfill_dag_runs"]) == 2 - - response = test_client.get(f"/backfills/{b.id}/dag_runs?limit=2&offset=2") - assert response.status_code == 200 - data = response.json() - assert len(data["backfill_dag_runs"]) == 1 - - def test_list_backfill_dag_runs_empty(self, test_client, session): - """Backfill with no dag runs returns empty list.""" - (dag,) = self._create_dag_models() - b = Backfill( - dag_id=dag.dag_id, from_date=pendulum.parse("2024-01-01"), to_date=pendulum.parse("2024-01-02") - ) - session.add(b) - session.commit() - - response = test_client.get(f"/backfills/{b.id}/dag_runs") - assert response.status_code == 200 - data = response.json() - assert data["total_entries"] == 0 - assert data["backfill_dag_runs"] == [] - - @pytest.mark.parametrize( - ("order_by", "expected_first_ordinal"), - [ - ("sort_ordinal", 1), - ("-sort_ordinal", 3), - ("id", 1), - ], - ) - def test_list_backfill_dag_runs_ordering(self, order_by, expected_first_ordinal, test_client, session): - """Verify sort contract for allowed order_by values.""" - (dag,) = self._create_dag_models() - b = Backfill( - dag_id=dag.dag_id, from_date=pendulum.parse("2024-01-01"), to_date=pendulum.parse("2024-01-03") - ) - session.add(b) - session.flush() - - for i in range(1, 4): - session.add( - BackfillDagRun( - backfill_id=b.id, - dag_run_id=None, - logical_date=pendulum.parse(f"2024-01-0{i}"), - sort_ordinal=i, - exception_reason="already exists", - ) - ) - session.commit() - - response = test_client.get(f"/backfills/{b.id}/dag_runs?order_by={order_by}") - assert response.status_code == 200 - data = response.json() - assert data["backfill_dag_runs"][0]["sort_ordinal"] == expected_first_ordinal - - class TestCreateBackfill(TestBackfillEndpoint): @pytest.mark.parametrize( ("repro_act", "repro_exp"), diff --git a/airflow-ctl/src/airflowctl/api/datamodels/generated.py b/airflow-ctl/src/airflowctl/api/datamodels/generated.py index 83bd18eb9425e..8804d2040ea4a 100644 --- a/airflow-ctl/src/airflowctl/api/datamodels/generated.py +++ b/airflow-ctl/src/airflowctl/api/datamodels/generated.py @@ -1365,22 +1365,6 @@ class AssetStateStoreResponse(BaseModel): last_updated_by: AssetStateStoreLastUpdatedBy | None = None -class BackfillDagRunResponse(BaseModel): - """ - Serializer for a single BackfillDagRun entry with joined DagRun state. - """ - - id: Annotated[int, Field(ge=0, title="Id")] - backfill_id: Annotated[int, Field(ge=0, title="Backfill Id")] - dag_id: Annotated[str, Field(title="Dag Id")] - dag_run_id: Annotated[str | None, Field(title="Dag Run Id")] = None - logical_date: Annotated[datetime | None, Field(title="Logical Date")] = None - partition_key: Annotated[str | None, Field(title="Partition Key")] = None - sort_ordinal: Annotated[int, Field(title="Sort Ordinal")] - exception_reason: Annotated[str | None, Field(title="Exception Reason")] = None - dag_run_state: DagRunState | None = None - - class BackfillPostBody(BaseModel): """ Object used for create backfill request. @@ -2267,15 +2251,6 @@ class BackfillCollectionResponse(BaseModel): total_entries: Annotated[int, Field(title="Total Entries")] -class BackfillDagRunCollectionResponse(BaseModel): - """ - BackfillDagRun Collection serializer for responses. - """ - - backfill_dag_runs: Annotated[list[BackfillDagRunResponse], Field(title="Backfill Dag Runs")] - total_entries: Annotated[int, Field(title="Total Entries")] - - class BulkBodyConnectionBody(BaseModel): model_config = ConfigDict( extra="forbid",