diff --git a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml index b487962498fb2..f221ad2739e96 100644 --- a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml +++ b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml @@ -2977,6 +2977,64 @@ paths: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' + /public/dags/{dag_id}/tasks/: + get: + tags: + - Task + summary: Get Tasks + description: Get tasks for DAG. + operationId: get_tasks + parameters: + - name: dag_id + in: path + required: true + schema: + type: string + title: Dag Id + - name: order_by + in: query + required: false + schema: + type: string + default: task_id + title: Order By + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/TaskCollectionResponse' + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPExceptionResponse' + description: Bad Request + '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' /public/dags/{dag_id}/tasks/{task_id}: get: tags: @@ -5178,6 +5236,22 @@ components: - latest_scheduler_heartbeat title: SchedulerInfoSchema description: Schema for Scheduler info. + TaskCollectionResponse: + properties: + tasks: + items: + $ref: '#/components/schemas/TaskResponse' + type: array + title: Tasks + total_entries: + type: integer + title: Total Entries + type: object + required: + - tasks + - total_entries + title: TaskCollectionResponse + description: Task collection serializer for responses. TaskDependencyCollectionResponse: properties: dependencies: diff --git a/airflow/ui/openapi-gen/queries/common.ts b/airflow/ui/openapi-gen/queries/common.ts index 51fc4d6d001ee..98ecdfde266e1 100644 --- a/airflow/ui/openapi-gen/queries/common.ts +++ b/airflow/ui/openapi-gen/queries/common.ts @@ -883,6 +883,24 @@ export const UseTaskInstanceServiceGetTaskInstancesKeyFn = ( }, ]), ]; +export type TaskServiceGetTasksDefaultResponse = Awaited< + ReturnType +>; +export type TaskServiceGetTasksQueryResult< + TData = TaskServiceGetTasksDefaultResponse, + TError = unknown, +> = UseQueryResult; +export const useTaskServiceGetTasksKey = "TaskServiceGetTasks"; +export const UseTaskServiceGetTasksKeyFn = ( + { + dagId, + orderBy, + }: { + dagId: string; + orderBy?: string; + }, + queryKey?: Array, +) => [useTaskServiceGetTasksKey, ...(queryKey ?? [{ dagId, orderBy }])]; export type TaskServiceGetTaskDefaultResponse = Awaited< ReturnType >; diff --git a/airflow/ui/openapi-gen/queries/prefetch.ts b/airflow/ui/openapi-gen/queries/prefetch.ts index 76d0a35e7bf08..b45f0c0ec1c43 100644 --- a/airflow/ui/openapi-gen/queries/prefetch.ts +++ b/airflow/ui/openapi-gen/queries/prefetch.ts @@ -1194,6 +1194,29 @@ export const prefetchUseTaskInstanceServiceGetTaskInstances = ( updatedAtLte, }), }); +/** + * Get Tasks + * Get tasks for DAG. + * @param data The data for the request. + * @param data.dagId + * @param data.orderBy + * @returns TaskCollectionResponse Successful Response + * @throws ApiError + */ +export const prefetchUseTaskServiceGetTasks = ( + queryClient: QueryClient, + { + dagId, + orderBy, + }: { + dagId: string; + orderBy?: string; + }, +) => + queryClient.prefetchQuery({ + queryKey: Common.UseTaskServiceGetTasksKeyFn({ dagId, orderBy }), + queryFn: () => TaskService.getTasks({ dagId, orderBy }), + }); /** * Get Task * Get simplified representation of a task. diff --git a/airflow/ui/openapi-gen/queries/queries.ts b/airflow/ui/openapi-gen/queries/queries.ts index 31b73b7aa263b..b1f127a96a974 100644 --- a/airflow/ui/openapi-gen/queries/queries.ts +++ b/airflow/ui/openapi-gen/queries/queries.ts @@ -1430,6 +1430,35 @@ export const useTaskInstanceServiceGetTaskInstances = < }) as TData, ...options, }); +/** + * Get Tasks + * Get tasks for DAG. + * @param data The data for the request. + * @param data.dagId + * @param data.orderBy + * @returns TaskCollectionResponse Successful Response + * @throws ApiError + */ +export const useTaskServiceGetTasks = < + TData = Common.TaskServiceGetTasksDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + dagId, + orderBy, + }: { + dagId: string; + orderBy?: string; + }, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useQuery({ + queryKey: Common.UseTaskServiceGetTasksKeyFn({ dagId, orderBy }, queryKey), + queryFn: () => TaskService.getTasks({ dagId, orderBy }) as TData, + ...options, + }); /** * Get Task * Get simplified representation of a task. diff --git a/airflow/ui/openapi-gen/queries/suspense.ts b/airflow/ui/openapi-gen/queries/suspense.ts index 534eafeca1f3e..68fcb065c26d9 100644 --- a/airflow/ui/openapi-gen/queries/suspense.ts +++ b/airflow/ui/openapi-gen/queries/suspense.ts @@ -1415,6 +1415,35 @@ export const useTaskInstanceServiceGetTaskInstancesSuspense = < }) as TData, ...options, }); +/** + * Get Tasks + * Get tasks for DAG. + * @param data The data for the request. + * @param data.dagId + * @param data.orderBy + * @returns TaskCollectionResponse Successful Response + * @throws ApiError + */ +export const useTaskServiceGetTasksSuspense = < + TData = Common.TaskServiceGetTasksDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + dagId, + orderBy, + }: { + dagId: string; + orderBy?: string; + }, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useSuspenseQuery({ + queryKey: Common.UseTaskServiceGetTasksKeyFn({ dagId, orderBy }, queryKey), + queryFn: () => TaskService.getTasks({ dagId, orderBy }) as TData, + ...options, + }); /** * Get Task * Get simplified representation of a task. diff --git a/airflow/ui/openapi-gen/requests/schemas.gen.ts b/airflow/ui/openapi-gen/requests/schemas.gen.ts index 4e90abbcddf42..9bf118b6b9810 100644 --- a/airflow/ui/openapi-gen/requests/schemas.gen.ts +++ b/airflow/ui/openapi-gen/requests/schemas.gen.ts @@ -2708,6 +2708,26 @@ export const $SchedulerInfoSchema = { description: "Schema for Scheduler info.", } as const; +export const $TaskCollectionResponse = { + properties: { + tasks: { + items: { + $ref: "#/components/schemas/TaskResponse", + }, + type: "array", + title: "Tasks", + }, + total_entries: { + type: "integer", + title: "Total Entries", + }, + }, + type: "object", + required: ["tasks", "total_entries"], + title: "TaskCollectionResponse", + description: "Task collection serializer for responses.", +} as const; + export const $TaskDependencyCollectionResponse = { properties: { dependencies: { diff --git a/airflow/ui/openapi-gen/requests/services.gen.ts b/airflow/ui/openapi-gen/requests/services.gen.ts index 16e3873458d07..b828494fc5f76 100644 --- a/airflow/ui/openapi-gen/requests/services.gen.ts +++ b/airflow/ui/openapi-gen/requests/services.gen.ts @@ -96,6 +96,8 @@ import type { GetMappedTaskInstanceResponse, GetTaskInstancesData, GetTaskInstancesResponse, + GetTasksData, + GetTasksResponse, GetTaskData, GetTaskResponse, DeleteVariableData, @@ -1605,6 +1607,37 @@ export class TaskInstanceService { } export class TaskService { + /** + * Get Tasks + * Get tasks for DAG. + * @param data The data for the request. + * @param data.dagId + * @param data.orderBy + * @returns TaskCollectionResponse Successful Response + * @throws ApiError + */ + public static getTasks( + data: GetTasksData, + ): CancelablePromise { + return __request(OpenAPI, { + method: "GET", + url: "/public/dags/{dag_id}/tasks/", + path: { + dag_id: data.dagId, + }, + query: { + order_by: data.orderBy, + }, + errors: { + 400: "Bad Request", + 401: "Unauthorized", + 403: "Forbidden", + 404: "Not Found", + 422: "Validation Error", + }, + }); + } + /** * Get Task * Get simplified representation of a task. diff --git a/airflow/ui/openapi-gen/requests/types.gen.ts b/airflow/ui/openapi-gen/requests/types.gen.ts index 3d6ad56983126..73decbb4f7f06 100644 --- a/airflow/ui/openapi-gen/requests/types.gen.ts +++ b/airflow/ui/openapi-gen/requests/types.gen.ts @@ -669,6 +669,14 @@ export type SchedulerInfoSchema = { latest_scheduler_heartbeat: string | null; }; +/** + * Task collection serializer for responses. + */ +export type TaskCollectionResponse = { + tasks: Array; + total_entries: number; +}; + /** * Task scheduling dependencies collection serializer for responses. */ @@ -1317,6 +1325,13 @@ export type GetTaskInstancesData = { export type GetTaskInstancesResponse = TaskInstanceCollectionResponse; +export type GetTasksData = { + dagId: string; + orderBy?: string; +}; + +export type GetTasksResponse = TaskCollectionResponse; + export type GetTaskData = { dagId: string; taskId: unknown; @@ -2575,6 +2590,37 @@ export type $OpenApiTs = { }; }; }; + "/public/dags/{dag_id}/tasks/": { + get: { + req: GetTasksData; + res: { + /** + * Successful Response + */ + 200: TaskCollectionResponse; + /** + * Bad Request + */ + 400: HTTPExceptionResponse; + /** + * Unauthorized + */ + 401: HTTPExceptionResponse; + /** + * Forbidden + */ + 403: HTTPExceptionResponse; + /** + * Not Found + */ + 404: HTTPExceptionResponse; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; "/public/dags/{dag_id}/tasks/{task_id}": { get: { req: GetTaskData;