From a3a80ec576ab6cb78c42befd4987bc892836aff8 Mon Sep 17 00:00:00 2001 From: Omkar P <45419097+omkar-foss@users.noreply.github.com> Date: Wed, 23 Oct 2024 15:32:54 +0530 Subject: [PATCH] Re-run static checks --- .../core_api/openapi/v1-generated.yaml | 98 +++++++++++++++++++ airflow/ui/openapi-gen/queries/common.ts | 17 ++++ airflow/ui/openapi-gen/queries/prefetch.ts | 21 ++++ airflow/ui/openapi-gen/queries/queries.ts | 27 +++++ airflow/ui/openapi-gen/queries/suspense.ts | 27 +++++ .../ui/openapi-gen/requests/schemas.gen.ts | 56 +++++++++++ .../ui/openapi-gen/requests/services.gen.ts | 31 ++++++ airflow/ui/openapi-gen/requests/types.gen.ts | 61 ++++++++++++ 8 files changed, 338 insertions(+) diff --git a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml index 182bde36b71a5..176206948dd33 100644 --- a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml +++ b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml @@ -1292,6 +1292,59 @@ paths: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' + /public/dagStats/: + get: + tags: + - DagStats + summary: Get Dag Stats + description: Get Dag statistics. + operationId: get_dag_stats + parameters: + - name: dag_ids + in: query + required: false + schema: + anyOf: + - type: string + - type: 'null' + title: Dag Ids + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DagStatsCollectionResponse' + '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': + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPExceptionResponse' + description: Unprocessable Entity components: schemas: AppBuilderMenuItemResponse: @@ -2032,6 +2085,51 @@ components: - asset_triggered title: DagRunType description: Class with DagRun types. + DagStatsCollectionResponse: + properties: + dags: + items: + $ref: '#/components/schemas/DagStatsResponse' + type: array + title: Dags + total_entries: + type: integer + title: Total Entries + type: object + required: + - dags + - total_entries + title: DagStatsCollectionResponse + description: DAG Stats Collection serializer for responses. + DagStatsResponse: + properties: + dag_id: + type: string + title: Dag Id + stats: + items: + $ref: '#/components/schemas/DagStatsStateResponse' + type: array + title: Stats + type: object + required: + - dag_id + - stats + title: DagStatsResponse + description: DAG Stats serializer for responses. + DagStatsStateResponse: + properties: + state: + $ref: '#/components/schemas/DagRunState' + count: + type: integer + title: Count + type: object + required: + - state + - count + title: DagStatsStateResponse + description: DagStatsState serializer for responses. DagTagPydantic: properties: name: diff --git a/airflow/ui/openapi-gen/queries/common.ts b/airflow/ui/openapi-gen/queries/common.ts index 45ffa188ac858..541a55a8786c3 100644 --- a/airflow/ui/openapi-gen/queries/common.ts +++ b/airflow/ui/openapi-gen/queries/common.ts @@ -6,6 +6,7 @@ import { ConnectionService, DagRunService, DagService, + DagStatsService, DashboardService, MonitorService, PluginService, @@ -345,6 +346,22 @@ export const UsePluginServiceGetPluginsKeyFn = ( } = {}, queryKey?: Array, ) => [usePluginServiceGetPluginsKey, ...(queryKey ?? [{ limit, offset }])]; +export type DagStatsServiceGetDagStatsDefaultResponse = Awaited< + ReturnType +>; +export type DagStatsServiceGetDagStatsQueryResult< + TData = DagStatsServiceGetDagStatsDefaultResponse, + TError = unknown, +> = UseQueryResult; +export const useDagStatsServiceGetDagStatsKey = "DagStatsServiceGetDagStats"; +export const UseDagStatsServiceGetDagStatsKeyFn = ( + { + dagIds, + }: { + dagIds?: string; + } = {}, + queryKey?: Array, +) => [useDagStatsServiceGetDagStatsKey, ...(queryKey ?? [{ dagIds }])]; export type VariableServicePostVariableMutationResult = Awaited< ReturnType >; diff --git a/airflow/ui/openapi-gen/queries/prefetch.ts b/airflow/ui/openapi-gen/queries/prefetch.ts index 36a6c251cb944..75f5f45fe5eb7 100644 --- a/airflow/ui/openapi-gen/queries/prefetch.ts +++ b/airflow/ui/openapi-gen/queries/prefetch.ts @@ -6,6 +6,7 @@ import { ConnectionService, DagRunService, DagService, + DagStatsService, DashboardService, MonitorService, PluginService, @@ -429,3 +430,23 @@ export const prefetchUsePluginServiceGetPlugins = ( queryKey: Common.UsePluginServiceGetPluginsKeyFn({ limit, offset }), queryFn: () => PluginService.getPlugins({ limit, offset }), }); +/** + * Get Dag Stats + * Get Dag statistics. + * @param data The data for the request. + * @param data.dagIds + * @returns DagStatsCollectionResponse Successful Response + * @throws ApiError + */ +export const prefetchUseDagStatsServiceGetDagStats = ( + queryClient: QueryClient, + { + dagIds, + }: { + dagIds?: string; + } = {}, +) => + queryClient.prefetchQuery({ + queryKey: Common.UseDagStatsServiceGetDagStatsKeyFn({ dagIds }), + queryFn: () => DagStatsService.getDagStats({ dagIds }), + }); diff --git a/airflow/ui/openapi-gen/queries/queries.ts b/airflow/ui/openapi-gen/queries/queries.ts index 288bef37335a3..895a2b496292f 100644 --- a/airflow/ui/openapi-gen/queries/queries.ts +++ b/airflow/ui/openapi-gen/queries/queries.ts @@ -11,6 +11,7 @@ import { ConnectionService, DagRunService, DagService, + DagStatsService, DashboardService, MonitorService, PluginService, @@ -557,6 +558,32 @@ export const usePluginServiceGetPlugins = < queryFn: () => PluginService.getPlugins({ limit, offset }) as TData, ...options, }); +/** + * Get Dag Stats + * Get Dag statistics. + * @param data The data for the request. + * @param data.dagIds + * @returns DagStatsCollectionResponse Successful Response + * @throws ApiError + */ +export const useDagStatsServiceGetDagStats = < + TData = Common.DagStatsServiceGetDagStatsDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + dagIds, + }: { + dagIds?: string; + } = {}, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useQuery({ + queryKey: Common.UseDagStatsServiceGetDagStatsKeyFn({ dagIds }, queryKey), + queryFn: () => DagStatsService.getDagStats({ dagIds }) as TData, + ...options, + }); /** * Post Variable * Create a variable. diff --git a/airflow/ui/openapi-gen/queries/suspense.ts b/airflow/ui/openapi-gen/queries/suspense.ts index 8fd858a985c4b..701549a2f8180 100644 --- a/airflow/ui/openapi-gen/queries/suspense.ts +++ b/airflow/ui/openapi-gen/queries/suspense.ts @@ -6,6 +6,7 @@ import { ConnectionService, DagRunService, DagService, + DagStatsService, DashboardService, MonitorService, PluginService, @@ -552,3 +553,29 @@ export const usePluginServiceGetPluginsSuspense = < queryFn: () => PluginService.getPlugins({ limit, offset }) as TData, ...options, }); +/** + * Get Dag Stats + * Get Dag statistics. + * @param data The data for the request. + * @param data.dagIds + * @returns DagStatsCollectionResponse Successful Response + * @throws ApiError + */ +export const useDagStatsServiceGetDagStatsSuspense = < + TData = Common.DagStatsServiceGetDagStatsDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + dagIds, + }: { + dagIds?: string; + } = {}, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useSuspenseQuery({ + queryKey: Common.UseDagStatsServiceGetDagStatsKeyFn({ dagIds }, queryKey), + queryFn: () => DagStatsService.getDagStats({ dagIds }) as TData, + ...options, + }); diff --git a/airflow/ui/openapi-gen/requests/schemas.gen.ts b/airflow/ui/openapi-gen/requests/schemas.gen.ts index f5ca444b535b2..cceb1b410e601 100644 --- a/airflow/ui/openapi-gen/requests/schemas.gen.ts +++ b/airflow/ui/openapi-gen/requests/schemas.gen.ts @@ -1187,6 +1187,62 @@ export const $DagRunType = { description: "Class with DagRun types.", } as const; +export const $DagStatsCollectionResponse = { + properties: { + dags: { + items: { + $ref: "#/components/schemas/DagStatsResponse", + }, + type: "array", + title: "Dags", + }, + total_entries: { + type: "integer", + title: "Total Entries", + }, + }, + type: "object", + required: ["dags", "total_entries"], + title: "DagStatsCollectionResponse", + description: "DAG Stats Collection serializer for responses.", +} as const; + +export const $DagStatsResponse = { + properties: { + dag_id: { + type: "string", + title: "Dag Id", + }, + stats: { + items: { + $ref: "#/components/schemas/DagStatsStateResponse", + }, + type: "array", + title: "Stats", + }, + }, + type: "object", + required: ["dag_id", "stats"], + title: "DagStatsResponse", + description: "DAG Stats serializer for responses.", +} as const; + +export const $DagStatsStateResponse = { + properties: { + state: { + $ref: "#/components/schemas/DagRunState", + }, + count: { + type: "integer", + title: "Count", + }, + }, + type: "object", + required: ["state", "count"], + title: "DagStatsStateResponse", + description: "DagStatsState serializer for responses.", +} as const; + export const $DagTagPydantic = { properties: { name: { diff --git a/airflow/ui/openapi-gen/requests/services.gen.ts b/airflow/ui/openapi-gen/requests/services.gen.ts index 8aa2949f29cde..a2c2a8ad5fda3 100644 --- a/airflow/ui/openapi-gen/requests/services.gen.ts +++ b/airflow/ui/openapi-gen/requests/services.gen.ts @@ -52,6 +52,8 @@ import type { GetProvidersResponse, GetPluginsData, GetPluginsResponse, + GetDagStatsData, + GetDagStatsResponse, } from "./types.gen"; export class AssetService { @@ -771,3 +773,32 @@ export class PluginService { }); } } + +export class DagStatsService { + /** + * Get Dag Stats + * Get Dag statistics. + * @param data The data for the request. + * @param data.dagIds + * @returns DagStatsCollectionResponse Successful Response + * @throws ApiError + */ + public static getDagStats( + data: GetDagStatsData = {}, + ): CancelablePromise { + return __request(OpenAPI, { + method: "GET", + url: "/public/dagStats/", + query: { + dag_ids: data.dagIds, + }, + errors: { + 400: "Bad Request", + 401: "Unauthorized", + 403: "Forbidden", + 404: "Not Found", + 422: "Unprocessable Entity", + }, + }); + } +} diff --git a/airflow/ui/openapi-gen/requests/types.gen.ts b/airflow/ui/openapi-gen/requests/types.gen.ts index 1e22e3937f6b2..5a1a8c0691116 100644 --- a/airflow/ui/openapi-gen/requests/types.gen.ts +++ b/airflow/ui/openapi-gen/requests/types.gen.ts @@ -245,6 +245,30 @@ export type DagRunType = | "manual" | "asset_triggered"; +/** + * DAG Stats Collection serializer for responses. + */ +export type DagStatsCollectionResponse = { + dags: Array; + total_entries: number; +}; + +/** + * DAG Stats serializer for responses. + */ +export type DagStatsResponse = { + dag_id: string; + stats: Array; +}; + +/** + * DagStatsState serializer for responses. + */ +export type DagStatsStateResponse = { + state: DagRunState; + count: number; +}; + /** * Serializable representation of the DagTag ORM SqlAlchemyModel used by internal API. */ @@ -617,6 +641,12 @@ export type GetPluginsData = { export type GetPluginsResponse = PluginCollectionResponse; +export type GetDagStatsData = { + dagIds?: string | null; +}; + +export type GetDagStatsResponse = DagStatsCollectionResponse; + export type $OpenApiTs = { "/ui/next_run_assets/{dag_id}": { get: { @@ -1224,4 +1254,35 @@ export type $OpenApiTs = { }; }; }; + "/public/dagStats/": { + get: { + req: GetDagStatsData; + res: { + /** + * Successful Response + */ + 200: DagStatsCollectionResponse; + /** + * Bad Request + */ + 400: HTTPExceptionResponse; + /** + * Unauthorized + */ + 401: HTTPExceptionResponse; + /** + * Forbidden + */ + 403: HTTPExceptionResponse; + /** + * Not Found + */ + 404: HTTPExceptionResponse; + /** + * Unprocessable Entity + */ + 422: HTTPExceptionResponse; + }; + }; + }; };