From ee693e7e8f6f2418df3a3954cdeae6c4a2800d04 Mon Sep 17 00:00:00 2001 From: Omkar P <45419097+omkar-foss@users.noreply.github.com> Date: Wed, 13 Nov 2024 13:23:10 +0530 Subject: [PATCH] Re-run static checks --- .../core_api/openapi/v1-generated.yaml | 246 +++++++++++++ airflow/ui/openapi-gen/queries/common.ts | 19 + airflow/ui/openapi-gen/queries/prefetch.ts | 24 ++ airflow/ui/openapi-gen/queries/queries.ts | 30 ++ airflow/ui/openapi-gen/queries/suspense.ts | 30 ++ .../ui/openapi-gen/requests/schemas.gen.ts | 344 ++++++++++++++++++ .../ui/openapi-gen/requests/services.gen.ts | 31 ++ airflow/ui/openapi-gen/requests/types.gen.ts | 88 +++++ 8 files changed, 812 insertions(+) diff --git a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml index b9b33b35e243..85e0437b78f3 100644 --- a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml +++ b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml @@ -3321,6 +3321,62 @@ paths: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' + /public/dags/{dag_id}/tasks/{task_id}: + get: + tags: + - Task + summary: Get Task + description: Get simplified representation of a task. + operationId: get_task + parameters: + - name: dag_id + in: path + required: true + schema: + type: string + title: Dag Id + - name: task_id + in: path + required: true + schema: + title: Task Id + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/TaskResponse' + '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' components: schemas: AppBuilderMenuItemResponse: @@ -5343,6 +5399,196 @@ components: - updated_at title: TaskOutletAssetReference description: Serializable version of the TaskOutletAssetReference ORM SqlAlchemyModel. + TaskResponse: + properties: + task_id: + anyOf: + - type: string + - type: 'null' + title: Task Id + task_display_name: + anyOf: + - type: string + - type: 'null' + title: Task Display Name + owner: + anyOf: + - type: string + - type: 'null' + title: Owner + start_date: + anyOf: + - type: string + format: date-time + - type: 'null' + title: Start Date + end_date: + anyOf: + - type: string + format: date-time + - type: 'null' + title: End Date + trigger_rule: + anyOf: + - type: string + - type: 'null' + title: Trigger Rule + depends_on_past: + type: boolean + title: Depends On Past + wait_for_downstream: + type: boolean + title: Wait For Downstream + retries: + anyOf: + - type: number + - type: 'null' + title: Retries + queue: + anyOf: + - type: string + - type: 'null' + title: Queue + pool: + anyOf: + - type: string + - type: 'null' + title: Pool + pool_slots: + anyOf: + - type: number + - type: 'null' + title: Pool Slots + execution_timeout: + anyOf: + - $ref: '#/components/schemas/TimeDelta' + - type: 'null' + retry_delay: + anyOf: + - $ref: '#/components/schemas/TimeDelta' + - type: 'null' + retry_exponential_backoff: + type: boolean + title: Retry Exponential Backoff + priority_weight: + anyOf: + - type: number + - type: 'null' + title: Priority Weight + weight_rule: + anyOf: + - type: string + - type: 'null' + title: Weight Rule + ui_color: + anyOf: + - type: string + - type: 'null' + title: Ui Color + ui_fgcolor: + anyOf: + - type: string + - type: 'null' + title: Ui Fgcolor + template_fields: + anyOf: + - items: + type: string + type: array + - type: 'null' + title: Template Fields + downstream_task_ids: + anyOf: + - items: + type: string + type: array + - type: 'null' + title: Downstream Task Ids + doc_md: + anyOf: + - type: string + - type: 'null' + title: Doc Md + operator_name: + anyOf: + - type: string + - type: 'null' + title: Operator Name + params: + anyOf: + - type: object + - type: 'null' + title: Params + class_ref: + anyOf: + - type: object + - type: 'null' + title: Class Ref + is_mapped: + anyOf: + - type: boolean + - type: 'null' + title: Is Mapped + extra_links: + items: + type: string + type: array + title: Extra Links + description: Extract and return extra_links. + readOnly: true + type: object + required: + - task_id + - task_display_name + - owner + - start_date + - end_date + - trigger_rule + - depends_on_past + - wait_for_downstream + - retries + - queue + - pool + - pool_slots + - execution_timeout + - retry_delay + - retry_exponential_backoff + - priority_weight + - weight_rule + - ui_color + - ui_fgcolor + - template_fields + - downstream_task_ids + - doc_md + - operator_name + - params + - class_ref + - is_mapped + - extra_links + title: TaskResponse + description: Task serializer for responses. + TimeDelta: + properties: + __type: + type: string + title: ' Type' + default: TimeDelta + days: + type: integer + title: Days + seconds: + type: integer + title: Seconds + microseconds: + type: integer + title: Microseconds + type: object + required: + - days + - seconds + - microseconds + title: TimeDelta + description: TimeDelta can be used to interact with datetime.timedelta objects. TriggerResponse: properties: id: diff --git a/airflow/ui/openapi-gen/queries/common.ts b/airflow/ui/openapi-gen/queries/common.ts index fd9fefda7dfb..af8ffb28c106 100644 --- a/airflow/ui/openapi-gen/queries/common.ts +++ b/airflow/ui/openapi-gen/queries/common.ts @@ -19,6 +19,7 @@ import { PoolService, ProviderService, TaskInstanceService, + TaskService, VariableService, VersionService, XcomService, @@ -966,6 +967,24 @@ export const UseXcomServiceGetXcomEntryKeyFn = ( { dagId, dagRunId, deserialize, mapIndex, stringify, taskId, xcomKey }, ]), ]; +export type TaskServiceGetTaskDefaultResponse = Awaited< + ReturnType +>; +export type TaskServiceGetTaskQueryResult< + TData = TaskServiceGetTaskDefaultResponse, + TError = unknown, +> = UseQueryResult; +export const useTaskServiceGetTaskKey = "TaskServiceGetTask"; +export const UseTaskServiceGetTaskKeyFn = ( + { + dagId, + taskId, + }: { + dagId: string; + taskId: unknown; + }, + queryKey?: Array, +) => [useTaskServiceGetTaskKey, ...(queryKey ?? [{ dagId, taskId }])]; export type BackfillServiceCreateBackfillMutationResult = Awaited< ReturnType >; diff --git a/airflow/ui/openapi-gen/queries/prefetch.ts b/airflow/ui/openapi-gen/queries/prefetch.ts index ba5d3b179045..12e95e45ec80 100644 --- a/airflow/ui/openapi-gen/queries/prefetch.ts +++ b/airflow/ui/openapi-gen/queries/prefetch.ts @@ -19,6 +19,7 @@ import { PoolService, ProviderService, TaskInstanceService, + TaskService, VariableService, VersionService, XcomService, @@ -1309,3 +1310,26 @@ export const prefetchUseXcomServiceGetXcomEntry = ( xcomKey, }), }); +/** + * Get Task + * Get simplified representation of a task. + * @param data The data for the request. + * @param data.dagId + * @param data.taskId + * @returns TaskResponse Successful Response + * @throws ApiError + */ +export const prefetchUseTaskServiceGetTask = ( + queryClient: QueryClient, + { + dagId, + taskId, + }: { + dagId: string; + taskId: unknown; + }, +) => + queryClient.prefetchQuery({ + queryKey: Common.UseTaskServiceGetTaskKeyFn({ dagId, taskId }), + queryFn: () => TaskService.getTask({ dagId, taskId }), + }); diff --git a/airflow/ui/openapi-gen/queries/queries.ts b/airflow/ui/openapi-gen/queries/queries.ts index 968419632ae7..89c404e25c99 100644 --- a/airflow/ui/openapi-gen/queries/queries.ts +++ b/airflow/ui/openapi-gen/queries/queries.ts @@ -24,6 +24,7 @@ import { PoolService, ProviderService, TaskInstanceService, + TaskService, VariableService, VersionService, XcomService, @@ -1569,6 +1570,35 @@ export const useXcomServiceGetXcomEntry = < }) as TData, ...options, }); +/** + * Get Task + * Get simplified representation of a task. + * @param data The data for the request. + * @param data.dagId + * @param data.taskId + * @returns TaskResponse Successful Response + * @throws ApiError + */ +export const useTaskServiceGetTask = < + TData = Common.TaskServiceGetTaskDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + dagId, + taskId, + }: { + dagId: string; + taskId: unknown; + }, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useQuery({ + queryKey: Common.UseTaskServiceGetTaskKeyFn({ dagId, taskId }, queryKey), + queryFn: () => TaskService.getTask({ dagId, taskId }) as TData, + ...options, + }); /** * Create Backfill * @param data The data for the request. diff --git a/airflow/ui/openapi-gen/queries/suspense.ts b/airflow/ui/openapi-gen/queries/suspense.ts index af737133dbaa..1b243a76af09 100644 --- a/airflow/ui/openapi-gen/queries/suspense.ts +++ b/airflow/ui/openapi-gen/queries/suspense.ts @@ -19,6 +19,7 @@ import { PoolService, ProviderService, TaskInstanceService, + TaskService, VariableService, VersionService, XcomService, @@ -1554,3 +1555,32 @@ export const useXcomServiceGetXcomEntrySuspense = < }) as TData, ...options, }); +/** + * Get Task + * Get simplified representation of a task. + * @param data The data for the request. + * @param data.dagId + * @param data.taskId + * @returns TaskResponse Successful Response + * @throws ApiError + */ +export const useTaskServiceGetTaskSuspense = < + TData = Common.TaskServiceGetTaskDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + dagId, + taskId, + }: { + dagId: string; + taskId: unknown; + }, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useSuspenseQuery({ + queryKey: Common.UseTaskServiceGetTaskKeyFn({ dagId, taskId }, queryKey), + queryFn: () => TaskService.getTask({ dagId, taskId }) as TData, + ...options, + }); diff --git a/airflow/ui/openapi-gen/requests/schemas.gen.ts b/airflow/ui/openapi-gen/requests/schemas.gen.ts index 106991531db6..bca6049a1348 100644 --- a/airflow/ui/openapi-gen/requests/schemas.gen.ts +++ b/airflow/ui/openapi-gen/requests/schemas.gen.ts @@ -3059,6 +3059,350 @@ export const $TaskOutletAssetReference = { "Serializable version of the TaskOutletAssetReference ORM SqlAlchemyModel.", } as const; +export const $TaskResponse = { + properties: { + task_id: { + anyOf: [ + { + type: "string", + }, + { + type: "null", + }, + ], + title: "Task Id", + }, + task_display_name: { + anyOf: [ + { + type: "string", + }, + { + type: "null", + }, + ], + title: "Task Display Name", + }, + owner: { + anyOf: [ + { + type: "string", + }, + { + type: "null", + }, + ], + title: "Owner", + }, + start_date: { + anyOf: [ + { + type: "string", + format: "date-time", + }, + { + type: "null", + }, + ], + title: "Start Date", + }, + end_date: { + anyOf: [ + { + type: "string", + format: "date-time", + }, + { + type: "null", + }, + ], + title: "End Date", + }, + trigger_rule: { + anyOf: [ + { + type: "string", + }, + { + type: "null", + }, + ], + title: "Trigger Rule", + }, + depends_on_past: { + type: "boolean", + title: "Depends On Past", + }, + wait_for_downstream: { + type: "boolean", + title: "Wait For Downstream", + }, + retries: { + anyOf: [ + { + type: "number", + }, + { + type: "null", + }, + ], + title: "Retries", + }, + queue: { + anyOf: [ + { + type: "string", + }, + { + type: "null", + }, + ], + title: "Queue", + }, + pool: { + anyOf: [ + { + type: "string", + }, + { + type: "null", + }, + ], + title: "Pool", + }, + pool_slots: { + anyOf: [ + { + type: "number", + }, + { + type: "null", + }, + ], + title: "Pool Slots", + }, + execution_timeout: { + anyOf: [ + { + $ref: "#/components/schemas/TimeDelta", + }, + { + type: "null", + }, + ], + }, + retry_delay: { + anyOf: [ + { + $ref: "#/components/schemas/TimeDelta", + }, + { + type: "null", + }, + ], + }, + retry_exponential_backoff: { + type: "boolean", + title: "Retry Exponential Backoff", + }, + priority_weight: { + anyOf: [ + { + type: "number", + }, + { + type: "null", + }, + ], + title: "Priority Weight", + }, + weight_rule: { + anyOf: [ + { + type: "string", + }, + { + type: "null", + }, + ], + title: "Weight Rule", + }, + ui_color: { + anyOf: [ + { + type: "string", + }, + { + type: "null", + }, + ], + title: "Ui Color", + }, + ui_fgcolor: { + anyOf: [ + { + type: "string", + }, + { + type: "null", + }, + ], + title: "Ui Fgcolor", + }, + template_fields: { + anyOf: [ + { + items: { + type: "string", + }, + type: "array", + }, + { + type: "null", + }, + ], + title: "Template Fields", + }, + downstream_task_ids: { + anyOf: [ + { + items: { + type: "string", + }, + type: "array", + }, + { + type: "null", + }, + ], + title: "Downstream Task Ids", + }, + doc_md: { + anyOf: [ + { + type: "string", + }, + { + type: "null", + }, + ], + title: "Doc Md", + }, + operator_name: { + anyOf: [ + { + type: "string", + }, + { + type: "null", + }, + ], + title: "Operator Name", + }, + params: { + anyOf: [ + { + type: "object", + }, + { + type: "null", + }, + ], + title: "Params", + }, + class_ref: { + anyOf: [ + { + type: "object", + }, + { + type: "null", + }, + ], + title: "Class Ref", + }, + is_mapped: { + anyOf: [ + { + type: "boolean", + }, + { + type: "null", + }, + ], + title: "Is Mapped", + }, + extra_links: { + items: { + type: "string", + }, + type: "array", + title: "Extra Links", + description: "Extract and return extra_links.", + readOnly: true, + }, + }, + type: "object", + required: [ + "task_id", + "task_display_name", + "owner", + "start_date", + "end_date", + "trigger_rule", + "depends_on_past", + "wait_for_downstream", + "retries", + "queue", + "pool", + "pool_slots", + "execution_timeout", + "retry_delay", + "retry_exponential_backoff", + "priority_weight", + "weight_rule", + "ui_color", + "ui_fgcolor", + "template_fields", + "downstream_task_ids", + "doc_md", + "operator_name", + "params", + "class_ref", + "is_mapped", + "extra_links", + ], + title: "TaskResponse", + description: "Task serializer for responses.", +} as const; + +export const $TimeDelta = { + properties: { + __type: { + type: "string", + title: " Type", + default: "TimeDelta", + }, + days: { + type: "integer", + title: "Days", + }, + seconds: { + type: "integer", + title: "Seconds", + }, + microseconds: { + type: "integer", + title: "Microseconds", + }, + }, + type: "object", + required: ["days", "seconds", "microseconds"], + title: "TimeDelta", + description: + "TimeDelta can be used to interact with datetime.timedelta objects.", +} as const; + export const $TriggerResponse = { properties: { id: { diff --git a/airflow/ui/openapi-gen/requests/services.gen.ts b/airflow/ui/openapi-gen/requests/services.gen.ts index 12897f9d4934..935200104a42 100644 --- a/airflow/ui/openapi-gen/requests/services.gen.ts +++ b/airflow/ui/openapi-gen/requests/services.gen.ts @@ -109,6 +109,8 @@ import type { GetDagStatsResponse, GetXcomEntryData, GetXcomEntryResponse, + GetTaskData, + GetTaskResponse, } from "./types.gen"; export class AssetService { @@ -1800,3 +1802,32 @@ export class XcomService { }); } } + +export class TaskService { + /** + * Get Task + * Get simplified representation of a task. + * @param data The data for the request. + * @param data.dagId + * @param data.taskId + * @returns TaskResponse Successful Response + * @throws ApiError + */ + public static getTask(data: GetTaskData): CancelablePromise { + return __request(OpenAPI, { + method: "GET", + url: "/public/dags/{dag_id}/tasks/{task_id}", + path: { + dag_id: data.dagId, + task_id: data.taskId, + }, + errors: { + 400: "Bad Request", + 401: "Unauthorized", + 403: "Forbidden", + 404: "Not Found", + 422: "Validation Error", + }, + }); + } +} diff --git a/airflow/ui/openapi-gen/requests/types.gen.ts b/airflow/ui/openapi-gen/requests/types.gen.ts index efd8f602528e..78b8d0c66b9d 100644 --- a/airflow/ui/openapi-gen/requests/types.gen.ts +++ b/airflow/ui/openapi-gen/requests/types.gen.ts @@ -750,6 +750,56 @@ export type TaskOutletAssetReference = { updated_at: string; }; +/** + * Task serializer for responses. + */ +export type TaskResponse = { + task_id: string | null; + task_display_name: string | null; + owner: string | null; + start_date: string | null; + end_date: string | null; + trigger_rule: string | null; + depends_on_past: boolean; + wait_for_downstream: boolean; + retries: number | null; + queue: string | null; + pool: string | null; + pool_slots: number | null; + execution_timeout: TimeDelta | null; + retry_delay: TimeDelta | null; + retry_exponential_backoff: boolean; + priority_weight: number | null; + weight_rule: string | null; + ui_color: string | null; + ui_fgcolor: string | null; + template_fields: Array | null; + downstream_task_ids: Array | null; + doc_md: string | null; + operator_name: string | null; + params: { + [key: string]: unknown; + } | null; + class_ref: { + [key: string]: unknown; + } | null; + is_mapped: boolean | null; + /** + * Extract and return extra_links. + */ + readonly extra_links: Array; +}; + +/** + * TimeDelta can be used to interact with datetime.timedelta objects. + */ +export type TimeDelta = { + __type?: string; + days: number; + seconds: number; + microseconds: number; +}; + /** * Trigger serializer for responses. */ @@ -1288,6 +1338,13 @@ export type GetXcomEntryData = { export type GetXcomEntryResponse = XComResponseNative | XComResponseString; +export type GetTaskData = { + dagId: string; + taskId: unknown; +}; + +export type GetTaskResponse = TaskResponse; + export type $OpenApiTs = { "/ui/next_run_assets/{dag_id}": { get: { @@ -2657,4 +2714,35 @@ export type $OpenApiTs = { }; }; }; + "/public/dags/{dag_id}/tasks/{task_id}": { + get: { + req: GetTaskData; + res: { + /** + * Successful Response + */ + 200: TaskResponse; + /** + * Bad Request + */ + 400: HTTPExceptionResponse; + /** + * Unauthorized + */ + 401: HTTPExceptionResponse; + /** + * Forbidden + */ + 403: HTTPExceptionResponse; + /** + * Not Found + */ + 404: HTTPExceptionResponse; + /** + * Validation Error + */ + 422: HTTPValidationError; + }; + }; + }; };