From 1351b08d86fe70127cd24623a0dd8efc99fd25bd Mon Sep 17 00:00:00 2001 From: Sneha Prabhu <122787562+prabhusneha@users.noreply.github.com> Date: Mon, 25 Nov 2024 22:23:57 +0530 Subject: [PATCH] AIP-84: Migrate Extra Links endpoint to fastapi (#44277) * migrate extra link endpoint to fastapi * add airflow license * add tests * Apply suggestions from code review Co-authored-by: Kalyan R * add teardown in test * change async to sync * Address PR comments and fix static checks * Address PR comment --------- Co-authored-by: Sneha Prabhu Co-authored-by: Kalyan R --- .../endpoints/extra_link_endpoint.py | 2 + .../core_api/datamodels/extra_links.py | 25 + .../core_api/openapi/v1-generated.yaml | 66 ++ .../core_api/routes/public/__init__.py | 3 + .../core_api/routes/public/extra_links.py | 85 ++ airflow/ui/openapi-gen/queries/common.ts | 371 +++--- airflow/ui/openapi-gen/queries/prefetch.ts | 462 ++++---- airflow/ui/openapi-gen/queries/queries.ts | 1003 +++++++++-------- airflow/ui/openapi-gen/queries/suspense.ts | 859 +++++++------- .../ui/openapi-gen/requests/schemas.gen.ts | 16 + .../ui/openapi-gen/requests/services.gen.ts | 930 ++++++++------- airflow/ui/openapi-gen/requests/types.gen.ts | 416 ++++--- .../routes/public/test_extra_links.py | 221 ++++ 13 files changed, 2620 insertions(+), 1839 deletions(-) create mode 100644 airflow/api_fastapi/core_api/datamodels/extra_links.py create mode 100644 airflow/api_fastapi/core_api/routes/public/extra_links.py create mode 100644 tests/api_fastapi/core_api/routes/public/test_extra_links.py diff --git a/airflow/api_connexion/endpoints/extra_link_endpoint.py b/airflow/api_connexion/endpoints/extra_link_endpoint.py index ddf4b670285c8..e5e015ac72403 100644 --- a/airflow/api_connexion/endpoints/extra_link_endpoint.py +++ b/airflow/api_connexion/endpoints/extra_link_endpoint.py @@ -25,6 +25,7 @@ from airflow.auth.managers.models.resource_details import DagAccessEntity from airflow.exceptions import TaskNotFound from airflow.utils.airflow_flask_app import get_airflow_app +from airflow.utils.api_migration import mark_fastapi_migration_done from airflow.utils.session import NEW_SESSION, provide_session if TYPE_CHECKING: @@ -35,6 +36,7 @@ from airflow.models.dagbag import DagBag +@mark_fastapi_migration_done @security.requires_access_dag("GET", DagAccessEntity.TASK_INSTANCE) @provide_session def get_extra_links( diff --git a/airflow/api_fastapi/core_api/datamodels/extra_links.py b/airflow/api_fastapi/core_api/datamodels/extra_links.py new file mode 100644 index 0000000000000..1e86c5a4bc25f --- /dev/null +++ b/airflow/api_fastapi/core_api/datamodels/extra_links.py @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +from pydantic import RootModel + + +class ExtraLinksResponse(RootModel): + """Extra Links Response.""" + + root: dict[str, str | None] diff --git a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml index 4bfd0e6568cdf..11a386942f306 100644 --- a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml +++ b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml @@ -2899,6 +2899,64 @@ paths: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' + /public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/links: + get: + tags: + - Extra Links + - Task Instance + summary: Get Extra Links + description: Get extra links for task instance. + operationId: get_extra_links + parameters: + - name: dag_id + in: path + required: true + schema: + type: string + title: Dag Id + - name: dag_run_id + in: path + required: true + schema: + type: string + title: Dag Run Id + - name: task_id + in: path + required: true + schema: + type: string + title: Task Id + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/ExtraLinksResponse' + '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/importErrors/{import_error_id}: get: tags: @@ -6734,6 +6792,14 @@ components: - extra title: EventLogResponse description: Event Log Response. + ExtraLinksResponse: + additionalProperties: + anyOf: + - type: string + - type: 'null' + type: object + title: ExtraLinksResponse + description: Extra Links Response. FastAPIAppResponse: properties: app: diff --git a/airflow/api_fastapi/core_api/routes/public/__init__.py b/airflow/api_fastapi/core_api/routes/public/__init__.py index 1222fbd009b87..e2dbed54f710c 100644 --- a/airflow/api_fastapi/core_api/routes/public/__init__.py +++ b/airflow/api_fastapi/core_api/routes/public/__init__.py @@ -31,6 +31,7 @@ from airflow.api_fastapi.core_api.routes.public.dag_warning import dag_warning_router from airflow.api_fastapi.core_api.routes.public.dags import dags_router from airflow.api_fastapi.core_api.routes.public.event_logs import event_logs_router +from airflow.api_fastapi.core_api.routes.public.extra_links import extra_links_router from airflow.api_fastapi.core_api.routes.public.import_error import import_error_router from airflow.api_fastapi.core_api.routes.public.job import job_router from airflow.api_fastapi.core_api.routes.public.log import task_instances_log_router @@ -61,6 +62,7 @@ authenticated_router.include_router(dag_warning_router) authenticated_router.include_router(dags_router) authenticated_router.include_router(event_logs_router) +authenticated_router.include_router(extra_links_router) authenticated_router.include_router(import_error_router) authenticated_router.include_router(job_router) authenticated_router.include_router(plugins_router) @@ -72,6 +74,7 @@ authenticated_router.include_router(xcom_router) authenticated_router.include_router(task_instances_log_router) + # Include authenticated router in public router public_router.include_router(authenticated_router) diff --git a/airflow/api_fastapi/core_api/routes/public/extra_links.py b/airflow/api_fastapi/core_api/routes/public/extra_links.py new file mode 100644 index 0000000000000..756031917c5bb --- /dev/null +++ b/airflow/api_fastapi/core_api/routes/public/extra_links.py @@ -0,0 +1,85 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from __future__ import annotations + +from typing import TYPE_CHECKING, Annotated + +from fastapi import Depends, HTTPException, Request, status +from sqlalchemy.orm import Session +from sqlalchemy.sql import select + +from airflow.api_fastapi.common.db.common import get_session +from airflow.api_fastapi.common.router import AirflowRouter +from airflow.api_fastapi.core_api.datamodels.extra_links import ExtraLinksResponse +from airflow.api_fastapi.core_api.openapi.exceptions import create_openapi_http_exception_doc +from airflow.exceptions import TaskNotFound + +if TYPE_CHECKING: + from sqlalchemy.orm.session import Session + + from airflow.models import DAG + + +extra_links_router = AirflowRouter( + tags=["Extra Links"], prefix="/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/links" +) + + +@extra_links_router.get( + "", + responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]), + tags=["Task Instance"], +) +def get_extra_links( + dag_id: str, + dag_run_id: str, + task_id: str, + session: Annotated[Session, Depends(get_session)], + request: Request, +) -> ExtraLinksResponse: + """Get extra links for task instance.""" + from airflow.models.taskinstance import TaskInstance + + dag: DAG = request.app.state.dag_bag.get_dag(dag_id) + if not dag: + raise HTTPException(status.HTTP_404_NOT_FOUND, f"DAG with ID = {dag_id} not found") + + try: + task = dag.get_task(task_id) + except TaskNotFound: + raise HTTPException(status.HTTP_404_NOT_FOUND, f"Task with ID = {task_id} not found") + + ti = session.scalar( + select(TaskInstance).where( + TaskInstance.dag_id == dag_id, + TaskInstance.run_id == dag_run_id, + TaskInstance.task_id == task_id, + ) + ) + + if not ti: + raise HTTPException( + status.HTTP_404_NOT_FOUND, + f"DAG Run with ID = {dag_run_id} not found", + ) + + all_extra_link_pairs = ( + (link_name, task.get_extra_links(ti, link_name)) for link_name in task.extra_links + ) + all_extra_links = {link_name: link_url or None for link_name, link_url in sorted(all_extra_link_pairs)} + return ExtraLinksResponse.model_validate(all_extra_links) diff --git a/airflow/ui/openapi-gen/queries/common.ts b/airflow/ui/openapi-gen/queries/common.ts index 7dd66d90793be..39884916d8038 100644 --- a/airflow/ui/openapi-gen/queries/common.ts +++ b/airflow/ui/openapi-gen/queries/common.ts @@ -14,6 +14,7 @@ import { DagsService, DashboardService, EventLogService, + ExtraLinksService, ImportErrorService, JobService, MonitorService, @@ -762,178 +763,54 @@ export const UseEventLogServiceGetEventLogsKeyFn = ( }, ]), ]; -export type ImportErrorServiceGetImportErrorDefaultResponse = Awaited< - ReturnType +export type ExtraLinksServiceGetExtraLinksDefaultResponse = Awaited< + ReturnType >; -export type ImportErrorServiceGetImportErrorQueryResult< - TData = ImportErrorServiceGetImportErrorDefaultResponse, +export type ExtraLinksServiceGetExtraLinksQueryResult< + TData = ExtraLinksServiceGetExtraLinksDefaultResponse, TError = unknown, > = UseQueryResult; -export const useImportErrorServiceGetImportErrorKey = - "ImportErrorServiceGetImportError"; -export const UseImportErrorServiceGetImportErrorKeyFn = ( +export const useExtraLinksServiceGetExtraLinksKey = + "ExtraLinksServiceGetExtraLinks"; +export const UseExtraLinksServiceGetExtraLinksKeyFn = ( { - importErrorId, + dagId, + dagRunId, + taskId, }: { - importErrorId: number; + dagId: string; + dagRunId: string; + taskId: string; }, queryKey?: Array, ) => [ - useImportErrorServiceGetImportErrorKey, - ...(queryKey ?? [{ importErrorId }]), + useExtraLinksServiceGetExtraLinksKey, + ...(queryKey ?? [{ dagId, dagRunId, taskId }]), ]; -export type ImportErrorServiceGetImportErrorsDefaultResponse = Awaited< - ReturnType +export type TaskInstanceServiceGetExtraLinksDefaultResponse = Awaited< + ReturnType >; -export type ImportErrorServiceGetImportErrorsQueryResult< - TData = ImportErrorServiceGetImportErrorsDefaultResponse, +export type TaskInstanceServiceGetExtraLinksQueryResult< + TData = TaskInstanceServiceGetExtraLinksDefaultResponse, TError = unknown, > = UseQueryResult; -export const useImportErrorServiceGetImportErrorsKey = - "ImportErrorServiceGetImportErrors"; -export const UseImportErrorServiceGetImportErrorsKeyFn = ( +export const useTaskInstanceServiceGetExtraLinksKey = + "TaskInstanceServiceGetExtraLinks"; +export const UseTaskInstanceServiceGetExtraLinksKeyFn = ( { - limit, - offset, - orderBy, - }: { - limit?: number; - offset?: number; - orderBy?: string; - } = {}, - queryKey?: Array, -) => [ - useImportErrorServiceGetImportErrorsKey, - ...(queryKey ?? [{ limit, offset, orderBy }]), -]; -export type JobServiceGetJobsDefaultResponse = Awaited< - ReturnType ->; -export type JobServiceGetJobsQueryResult< - TData = JobServiceGetJobsDefaultResponse, - TError = unknown, -> = UseQueryResult; -export const useJobServiceGetJobsKey = "JobServiceGetJobs"; -export const UseJobServiceGetJobsKeyFn = ( - { - endDateGte, - endDateLte, - executorClass, - hostname, - isAlive, - jobState, - jobType, - limit, - offset, - orderBy, - startDateGte, - startDateLte, + dagId, + dagRunId, + taskId, }: { - endDateGte?: string; - endDateLte?: string; - executorClass?: string; - hostname?: string; - isAlive?: boolean; - jobState?: string; - jobType?: string; - limit?: number; - offset?: number; - orderBy?: string; - startDateGte?: string; - startDateLte?: string; - } = {}, + dagId: string; + dagRunId: string; + taskId: string; + }, queryKey?: Array, ) => [ - useJobServiceGetJobsKey, - ...(queryKey ?? [ - { - endDateGte, - endDateLte, - executorClass, - hostname, - isAlive, - jobState, - jobType, - limit, - offset, - orderBy, - startDateGte, - startDateLte, - }, - ]), + useTaskInstanceServiceGetExtraLinksKey, + ...(queryKey ?? [{ dagId, dagRunId, taskId }]), ]; -export type PluginServiceGetPluginsDefaultResponse = Awaited< - ReturnType ->; -export type PluginServiceGetPluginsQueryResult< - TData = PluginServiceGetPluginsDefaultResponse, - TError = unknown, -> = UseQueryResult; -export const usePluginServiceGetPluginsKey = "PluginServiceGetPlugins"; -export const UsePluginServiceGetPluginsKeyFn = ( - { - limit, - offset, - }: { - limit?: number; - offset?: number; - } = {}, - queryKey?: Array, -) => [usePluginServiceGetPluginsKey, ...(queryKey ?? [{ limit, offset }])]; -export type PoolServiceGetPoolDefaultResponse = Awaited< - ReturnType ->; -export type PoolServiceGetPoolQueryResult< - TData = PoolServiceGetPoolDefaultResponse, - TError = unknown, -> = UseQueryResult; -export const usePoolServiceGetPoolKey = "PoolServiceGetPool"; -export const UsePoolServiceGetPoolKeyFn = ( - { - poolName, - }: { - poolName: string; - }, - queryKey?: Array, -) => [usePoolServiceGetPoolKey, ...(queryKey ?? [{ poolName }])]; -export type PoolServiceGetPoolsDefaultResponse = Awaited< - ReturnType ->; -export type PoolServiceGetPoolsQueryResult< - TData = PoolServiceGetPoolsDefaultResponse, - TError = unknown, -> = UseQueryResult; -export const usePoolServiceGetPoolsKey = "PoolServiceGetPools"; -export const UsePoolServiceGetPoolsKeyFn = ( - { - limit, - offset, - orderBy, - }: { - limit?: number; - offset?: number; - orderBy?: string; - } = {}, - queryKey?: Array, -) => [usePoolServiceGetPoolsKey, ...(queryKey ?? [{ limit, offset, orderBy }])]; -export type ProviderServiceGetProvidersDefaultResponse = Awaited< - ReturnType ->; -export type ProviderServiceGetProvidersQueryResult< - TData = ProviderServiceGetProvidersDefaultResponse, - TError = unknown, -> = UseQueryResult; -export const useProviderServiceGetProvidersKey = "ProviderServiceGetProviders"; -export const UseProviderServiceGetProvidersKeyFn = ( - { - limit, - offset, - }: { - limit?: number; - offset?: number; - } = {}, - queryKey?: Array, -) => [useProviderServiceGetProvidersKey, ...(queryKey ?? [{ limit, offset }])]; export type TaskInstanceServiceGetTaskInstanceDefaultResponse = Awaited< ReturnType >; @@ -1293,6 +1170,178 @@ export const UseTaskInstanceServiceGetLogKeyFn = ( }, ]), ]; +export type ImportErrorServiceGetImportErrorDefaultResponse = Awaited< + ReturnType +>; +export type ImportErrorServiceGetImportErrorQueryResult< + TData = ImportErrorServiceGetImportErrorDefaultResponse, + TError = unknown, +> = UseQueryResult; +export const useImportErrorServiceGetImportErrorKey = + "ImportErrorServiceGetImportError"; +export const UseImportErrorServiceGetImportErrorKeyFn = ( + { + importErrorId, + }: { + importErrorId: number; + }, + queryKey?: Array, +) => [ + useImportErrorServiceGetImportErrorKey, + ...(queryKey ?? [{ importErrorId }]), +]; +export type ImportErrorServiceGetImportErrorsDefaultResponse = Awaited< + ReturnType +>; +export type ImportErrorServiceGetImportErrorsQueryResult< + TData = ImportErrorServiceGetImportErrorsDefaultResponse, + TError = unknown, +> = UseQueryResult; +export const useImportErrorServiceGetImportErrorsKey = + "ImportErrorServiceGetImportErrors"; +export const UseImportErrorServiceGetImportErrorsKeyFn = ( + { + limit, + offset, + orderBy, + }: { + limit?: number; + offset?: number; + orderBy?: string; + } = {}, + queryKey?: Array, +) => [ + useImportErrorServiceGetImportErrorsKey, + ...(queryKey ?? [{ limit, offset, orderBy }]), +]; +export type JobServiceGetJobsDefaultResponse = Awaited< + ReturnType +>; +export type JobServiceGetJobsQueryResult< + TData = JobServiceGetJobsDefaultResponse, + TError = unknown, +> = UseQueryResult; +export const useJobServiceGetJobsKey = "JobServiceGetJobs"; +export const UseJobServiceGetJobsKeyFn = ( + { + endDateGte, + endDateLte, + executorClass, + hostname, + isAlive, + jobState, + jobType, + limit, + offset, + orderBy, + startDateGte, + startDateLte, + }: { + endDateGte?: string; + endDateLte?: string; + executorClass?: string; + hostname?: string; + isAlive?: boolean; + jobState?: string; + jobType?: string; + limit?: number; + offset?: number; + orderBy?: string; + startDateGte?: string; + startDateLte?: string; + } = {}, + queryKey?: Array, +) => [ + useJobServiceGetJobsKey, + ...(queryKey ?? [ + { + endDateGte, + endDateLte, + executorClass, + hostname, + isAlive, + jobState, + jobType, + limit, + offset, + orderBy, + startDateGte, + startDateLte, + }, + ]), +]; +export type PluginServiceGetPluginsDefaultResponse = Awaited< + ReturnType +>; +export type PluginServiceGetPluginsQueryResult< + TData = PluginServiceGetPluginsDefaultResponse, + TError = unknown, +> = UseQueryResult; +export const usePluginServiceGetPluginsKey = "PluginServiceGetPlugins"; +export const UsePluginServiceGetPluginsKeyFn = ( + { + limit, + offset, + }: { + limit?: number; + offset?: number; + } = {}, + queryKey?: Array, +) => [usePluginServiceGetPluginsKey, ...(queryKey ?? [{ limit, offset }])]; +export type PoolServiceGetPoolDefaultResponse = Awaited< + ReturnType +>; +export type PoolServiceGetPoolQueryResult< + TData = PoolServiceGetPoolDefaultResponse, + TError = unknown, +> = UseQueryResult; +export const usePoolServiceGetPoolKey = "PoolServiceGetPool"; +export const UsePoolServiceGetPoolKeyFn = ( + { + poolName, + }: { + poolName: string; + }, + queryKey?: Array, +) => [usePoolServiceGetPoolKey, ...(queryKey ?? [{ poolName }])]; +export type PoolServiceGetPoolsDefaultResponse = Awaited< + ReturnType +>; +export type PoolServiceGetPoolsQueryResult< + TData = PoolServiceGetPoolsDefaultResponse, + TError = unknown, +> = UseQueryResult; +export const usePoolServiceGetPoolsKey = "PoolServiceGetPools"; +export const UsePoolServiceGetPoolsKeyFn = ( + { + limit, + offset, + orderBy, + }: { + limit?: number; + offset?: number; + orderBy?: string; + } = {}, + queryKey?: Array, +) => [usePoolServiceGetPoolsKey, ...(queryKey ?? [{ limit, offset, orderBy }])]; +export type ProviderServiceGetProvidersDefaultResponse = Awaited< + ReturnType +>; +export type ProviderServiceGetProvidersQueryResult< + TData = ProviderServiceGetProvidersDefaultResponse, + TError = unknown, +> = UseQueryResult; +export const useProviderServiceGetProvidersKey = "ProviderServiceGetProviders"; +export const UseProviderServiceGetProvidersKeyFn = ( + { + limit, + offset, + }: { + limit?: number; + offset?: number; + } = {}, + queryKey?: Array, +) => [useProviderServiceGetProvidersKey, ...(queryKey ?? [{ limit, offset }])]; export type TaskServiceGetTasksDefaultResponse = Awaited< ReturnType >; @@ -1440,18 +1489,18 @@ export type ConnectionServiceTestConnectionMutationResult = Awaited< export type DagRunServiceClearDagRunMutationResult = Awaited< ReturnType >; -export type PoolServicePostPoolMutationResult = Awaited< - ReturnType ->; -export type PoolServicePostPoolsMutationResult = Awaited< - ReturnType ->; export type TaskInstanceServiceGetTaskInstancesBatchMutationResult = Awaited< ReturnType >; export type TaskInstanceServicePostClearTaskInstancesMutationResult = Awaited< ReturnType >; +export type PoolServicePostPoolMutationResult = Awaited< + ReturnType +>; +export type PoolServicePostPoolsMutationResult = Awaited< + ReturnType +>; export type VariableServicePostVariableMutationResult = Awaited< ReturnType >; diff --git a/airflow/ui/openapi-gen/queries/prefetch.ts b/airflow/ui/openapi-gen/queries/prefetch.ts index ae0d960d0764a..53c1cc14236d4 100644 --- a/airflow/ui/openapi-gen/queries/prefetch.ts +++ b/airflow/ui/openapi-gen/queries/prefetch.ts @@ -14,6 +14,7 @@ import { DagsService, DashboardService, EventLogService, + ExtraLinksService, ImportErrorService, JobService, MonitorService, @@ -993,228 +994,65 @@ export const prefetchUseEventLogServiceGetEventLogs = ( }), }); /** - * Get Import Error - * Get an import error. + * Get Extra Links + * Get extra links for task instance. * @param data The data for the request. - * @param data.importErrorId - * @returns ImportErrorResponse Successful Response + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @returns ExtraLinksResponse Successful Response * @throws ApiError */ -export const prefetchUseImportErrorServiceGetImportError = ( +export const prefetchUseExtraLinksServiceGetExtraLinks = ( queryClient: QueryClient, { - importErrorId, + dagId, + dagRunId, + taskId, }: { - importErrorId: number; + dagId: string; + dagRunId: string; + taskId: string; }, ) => queryClient.prefetchQuery({ - queryKey: Common.UseImportErrorServiceGetImportErrorKeyFn({ - importErrorId, - }), - queryFn: () => ImportErrorService.getImportError({ importErrorId }), - }); -/** - * Get Import Errors - * Get all import errors. - * @param data The data for the request. - * @param data.limit - * @param data.offset - * @param data.orderBy - * @returns ImportErrorCollectionResponse Successful Response - * @throws ApiError - */ -export const prefetchUseImportErrorServiceGetImportErrors = ( - queryClient: QueryClient, - { - limit, - offset, - orderBy, - }: { - limit?: number; - offset?: number; - orderBy?: string; - } = {}, -) => - queryClient.prefetchQuery({ - queryKey: Common.UseImportErrorServiceGetImportErrorsKeyFn({ - limit, - offset, - orderBy, + queryKey: Common.UseExtraLinksServiceGetExtraLinksKeyFn({ + dagId, + dagRunId, + taskId, }), - queryFn: () => - ImportErrorService.getImportErrors({ limit, offset, orderBy }), + queryFn: () => ExtraLinksService.getExtraLinks({ dagId, dagRunId, taskId }), }); /** - * Get Jobs - * Get all jobs. + * Get Extra Links + * Get extra links for task instance. * @param data The data for the request. - * @param data.isAlive - * @param data.startDateGte - * @param data.startDateLte - * @param data.endDateGte - * @param data.endDateLte - * @param data.limit - * @param data.offset - * @param data.orderBy - * @param data.jobState - * @param data.jobType - * @param data.hostname - * @param data.executorClass - * @returns JobCollectionResponse Successful Response + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @returns ExtraLinksResponse Successful Response * @throws ApiError */ -export const prefetchUseJobServiceGetJobs = ( +export const prefetchUseTaskInstanceServiceGetExtraLinks = ( queryClient: QueryClient, { - endDateGte, - endDateLte, - executorClass, - hostname, - isAlive, - jobState, - jobType, - limit, - offset, - orderBy, - startDateGte, - startDateLte, + dagId, + dagRunId, + taskId, }: { - endDateGte?: string; - endDateLte?: string; - executorClass?: string; - hostname?: string; - isAlive?: boolean; - jobState?: string; - jobType?: string; - limit?: number; - offset?: number; - orderBy?: string; - startDateGte?: string; - startDateLte?: string; - } = {}, + dagId: string; + dagRunId: string; + taskId: string; + }, ) => queryClient.prefetchQuery({ - queryKey: Common.UseJobServiceGetJobsKeyFn({ - endDateGte, - endDateLte, - executorClass, - hostname, - isAlive, - jobState, - jobType, - limit, - offset, - orderBy, - startDateGte, - startDateLte, + queryKey: Common.UseTaskInstanceServiceGetExtraLinksKeyFn({ + dagId, + dagRunId, + taskId, }), queryFn: () => - JobService.getJobs({ - endDateGte, - endDateLte, - executorClass, - hostname, - isAlive, - jobState, - jobType, - limit, - offset, - orderBy, - startDateGte, - startDateLte, - }), - }); -/** - * Get Plugins - * @param data The data for the request. - * @param data.limit - * @param data.offset - * @returns PluginCollectionResponse Successful Response - * @throws ApiError - */ -export const prefetchUsePluginServiceGetPlugins = ( - queryClient: QueryClient, - { - limit, - offset, - }: { - limit?: number; - offset?: number; - } = {}, -) => - queryClient.prefetchQuery({ - queryKey: Common.UsePluginServiceGetPluginsKeyFn({ limit, offset }), - queryFn: () => PluginService.getPlugins({ limit, offset }), - }); -/** - * Get Pool - * Get a pool. - * @param data The data for the request. - * @param data.poolName - * @returns PoolResponse Successful Response - * @throws ApiError - */ -export const prefetchUsePoolServiceGetPool = ( - queryClient: QueryClient, - { - poolName, - }: { - poolName: string; - }, -) => - queryClient.prefetchQuery({ - queryKey: Common.UsePoolServiceGetPoolKeyFn({ poolName }), - queryFn: () => PoolService.getPool({ poolName }), - }); -/** - * Get Pools - * Get all pools entries. - * @param data The data for the request. - * @param data.limit - * @param data.offset - * @param data.orderBy - * @returns PoolCollectionResponse Successful Response - * @throws ApiError - */ -export const prefetchUsePoolServiceGetPools = ( - queryClient: QueryClient, - { - limit, - offset, - orderBy, - }: { - limit?: number; - offset?: number; - orderBy?: string; - } = {}, -) => - queryClient.prefetchQuery({ - queryKey: Common.UsePoolServiceGetPoolsKeyFn({ limit, offset, orderBy }), - queryFn: () => PoolService.getPools({ limit, offset, orderBy }), - }); -/** - * Get Providers - * Get providers. - * @param data The data for the request. - * @param data.limit - * @param data.offset - * @returns ProviderCollectionResponse Successful Response - * @throws ApiError - */ -export const prefetchUseProviderServiceGetProviders = ( - queryClient: QueryClient, - { - limit, - offset, - }: { - limit?: number; - offset?: number; - } = {}, -) => - queryClient.prefetchQuery({ - queryKey: Common.UseProviderServiceGetProvidersKeyFn({ limit, offset }), - queryFn: () => ProviderService.getProviders({ limit, offset }), + TaskInstanceService.getExtraLinks({ dagId, dagRunId, taskId }), }); /** * Get Task Instance @@ -1750,6 +1588,230 @@ export const prefetchUseTaskInstanceServiceGetLog = ( tryNumber, }), }); +/** + * Get Import Error + * Get an import error. + * @param data The data for the request. + * @param data.importErrorId + * @returns ImportErrorResponse Successful Response + * @throws ApiError + */ +export const prefetchUseImportErrorServiceGetImportError = ( + queryClient: QueryClient, + { + importErrorId, + }: { + importErrorId: number; + }, +) => + queryClient.prefetchQuery({ + queryKey: Common.UseImportErrorServiceGetImportErrorKeyFn({ + importErrorId, + }), + queryFn: () => ImportErrorService.getImportError({ importErrorId }), + }); +/** + * Get Import Errors + * Get all import errors. + * @param data The data for the request. + * @param data.limit + * @param data.offset + * @param data.orderBy + * @returns ImportErrorCollectionResponse Successful Response + * @throws ApiError + */ +export const prefetchUseImportErrorServiceGetImportErrors = ( + queryClient: QueryClient, + { + limit, + offset, + orderBy, + }: { + limit?: number; + offset?: number; + orderBy?: string; + } = {}, +) => + queryClient.prefetchQuery({ + queryKey: Common.UseImportErrorServiceGetImportErrorsKeyFn({ + limit, + offset, + orderBy, + }), + queryFn: () => + ImportErrorService.getImportErrors({ limit, offset, orderBy }), + }); +/** + * Get Jobs + * Get all jobs. + * @param data The data for the request. + * @param data.isAlive + * @param data.startDateGte + * @param data.startDateLte + * @param data.endDateGte + * @param data.endDateLte + * @param data.limit + * @param data.offset + * @param data.orderBy + * @param data.jobState + * @param data.jobType + * @param data.hostname + * @param data.executorClass + * @returns JobCollectionResponse Successful Response + * @throws ApiError + */ +export const prefetchUseJobServiceGetJobs = ( + queryClient: QueryClient, + { + endDateGte, + endDateLte, + executorClass, + hostname, + isAlive, + jobState, + jobType, + limit, + offset, + orderBy, + startDateGte, + startDateLte, + }: { + endDateGte?: string; + endDateLte?: string; + executorClass?: string; + hostname?: string; + isAlive?: boolean; + jobState?: string; + jobType?: string; + limit?: number; + offset?: number; + orderBy?: string; + startDateGte?: string; + startDateLte?: string; + } = {}, +) => + queryClient.prefetchQuery({ + queryKey: Common.UseJobServiceGetJobsKeyFn({ + endDateGte, + endDateLte, + executorClass, + hostname, + isAlive, + jobState, + jobType, + limit, + offset, + orderBy, + startDateGte, + startDateLte, + }), + queryFn: () => + JobService.getJobs({ + endDateGte, + endDateLte, + executorClass, + hostname, + isAlive, + jobState, + jobType, + limit, + offset, + orderBy, + startDateGte, + startDateLte, + }), + }); +/** + * Get Plugins + * @param data The data for the request. + * @param data.limit + * @param data.offset + * @returns PluginCollectionResponse Successful Response + * @throws ApiError + */ +export const prefetchUsePluginServiceGetPlugins = ( + queryClient: QueryClient, + { + limit, + offset, + }: { + limit?: number; + offset?: number; + } = {}, +) => + queryClient.prefetchQuery({ + queryKey: Common.UsePluginServiceGetPluginsKeyFn({ limit, offset }), + queryFn: () => PluginService.getPlugins({ limit, offset }), + }); +/** + * Get Pool + * Get a pool. + * @param data The data for the request. + * @param data.poolName + * @returns PoolResponse Successful Response + * @throws ApiError + */ +export const prefetchUsePoolServiceGetPool = ( + queryClient: QueryClient, + { + poolName, + }: { + poolName: string; + }, +) => + queryClient.prefetchQuery({ + queryKey: Common.UsePoolServiceGetPoolKeyFn({ poolName }), + queryFn: () => PoolService.getPool({ poolName }), + }); +/** + * Get Pools + * Get all pools entries. + * @param data The data for the request. + * @param data.limit + * @param data.offset + * @param data.orderBy + * @returns PoolCollectionResponse Successful Response + * @throws ApiError + */ +export const prefetchUsePoolServiceGetPools = ( + queryClient: QueryClient, + { + limit, + offset, + orderBy, + }: { + limit?: number; + offset?: number; + orderBy?: string; + } = {}, +) => + queryClient.prefetchQuery({ + queryKey: Common.UsePoolServiceGetPoolsKeyFn({ limit, offset, orderBy }), + queryFn: () => PoolService.getPools({ limit, offset, orderBy }), + }); +/** + * Get Providers + * Get providers. + * @param data The data for the request. + * @param data.limit + * @param data.offset + * @returns ProviderCollectionResponse Successful Response + * @throws ApiError + */ +export const prefetchUseProviderServiceGetProviders = ( + queryClient: QueryClient, + { + limit, + offset, + }: { + limit?: number; + offset?: number; + } = {}, +) => + queryClient.prefetchQuery({ + queryKey: Common.UseProviderServiceGetProvidersKeyFn({ limit, offset }), + queryFn: () => ProviderService.getProviders({ limit, offset }), + }); /** * Get Tasks * Get tasks for DAG. diff --git a/airflow/ui/openapi-gen/queries/queries.ts b/airflow/ui/openapi-gen/queries/queries.ts index 8bd4db19c61fe..88e0ba84ef1b0 100644 --- a/airflow/ui/openapi-gen/queries/queries.ts +++ b/airflow/ui/openapi-gen/queries/queries.ts @@ -19,6 +19,7 @@ import { DagsService, DashboardService, EventLogService, + ExtraLinksService, ImportErrorService, JobService, MonitorService, @@ -1219,327 +1220,383 @@ export const useEventLogServiceGetEventLogs = < ...options, }); /** - * Get Import Error - * Get an import error. + * Get Extra Links + * Get extra links for task instance. * @param data The data for the request. - * @param data.importErrorId - * @returns ImportErrorResponse Successful Response + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @returns ExtraLinksResponse Successful Response * @throws ApiError */ -export const useImportErrorServiceGetImportError = < - TData = Common.ImportErrorServiceGetImportErrorDefaultResponse, +export const useExtraLinksServiceGetExtraLinks = < + TData = Common.ExtraLinksServiceGetExtraLinksDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - importErrorId, + dagId, + dagRunId, + taskId, }: { - importErrorId: number; + dagId: string; + dagRunId: string; + taskId: string; }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useQuery({ - queryKey: Common.UseImportErrorServiceGetImportErrorKeyFn( - { importErrorId }, + queryKey: Common.UseExtraLinksServiceGetExtraLinksKeyFn( + { dagId, dagRunId, taskId }, queryKey, ), queryFn: () => - ImportErrorService.getImportError({ importErrorId }) as TData, + ExtraLinksService.getExtraLinks({ dagId, dagRunId, taskId }) as TData, ...options, }); /** - * Get Import Errors - * Get all import errors. + * Get Extra Links + * Get extra links for task instance. * @param data The data for the request. - * @param data.limit - * @param data.offset - * @param data.orderBy - * @returns ImportErrorCollectionResponse Successful Response + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @returns ExtraLinksResponse Successful Response * @throws ApiError */ -export const useImportErrorServiceGetImportErrors = < - TData = Common.ImportErrorServiceGetImportErrorsDefaultResponse, +export const useTaskInstanceServiceGetExtraLinks = < + TData = Common.TaskInstanceServiceGetExtraLinksDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - limit, - offset, - orderBy, + dagId, + dagRunId, + taskId, }: { - limit?: number; - offset?: number; - orderBy?: string; - } = {}, + dagId: string; + dagRunId: string; + taskId: string; + }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useQuery({ - queryKey: Common.UseImportErrorServiceGetImportErrorsKeyFn( - { limit, offset, orderBy }, + queryKey: Common.UseTaskInstanceServiceGetExtraLinksKeyFn( + { dagId, dagRunId, taskId }, queryKey, ), queryFn: () => - ImportErrorService.getImportErrors({ limit, offset, orderBy }) as TData, + TaskInstanceService.getExtraLinks({ dagId, dagRunId, taskId }) as TData, ...options, }); /** - * Get Jobs - * Get all jobs. + * Get Task Instance + * Get task instance. * @param data The data for the request. - * @param data.isAlive + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @returns TaskInstanceResponse Successful Response + * @throws ApiError + */ +export const useTaskInstanceServiceGetTaskInstance = < + TData = Common.TaskInstanceServiceGetTaskInstanceDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + dagId, + dagRunId, + taskId, + }: { + dagId: string; + dagRunId: string; + taskId: string; + }, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useQuery({ + queryKey: Common.UseTaskInstanceServiceGetTaskInstanceKeyFn( + { dagId, dagRunId, taskId }, + queryKey, + ), + queryFn: () => + TaskInstanceService.getTaskInstance({ dagId, dagRunId, taskId }) as TData, + ...options, + }); +/** + * Get Mapped Task Instances + * Get list of mapped task instances. + * @param data The data for the request. + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @param data.logicalDateGte + * @param data.logicalDateLte * @param data.startDateGte * @param data.startDateLte * @param data.endDateGte * @param data.endDateLte + * @param data.updatedAtGte + * @param data.updatedAtLte + * @param data.durationGte + * @param data.durationLte + * @param data.state + * @param data.pool + * @param data.queue + * @param data.executor * @param data.limit * @param data.offset * @param data.orderBy - * @param data.jobState - * @param data.jobType - * @param data.hostname - * @param data.executorClass - * @returns JobCollectionResponse Successful Response + * @returns TaskInstanceCollectionResponse Successful Response * @throws ApiError */ -export const useJobServiceGetJobs = < - TData = Common.JobServiceGetJobsDefaultResponse, +export const useTaskInstanceServiceGetMappedTaskInstances = < + TData = Common.TaskInstanceServiceGetMappedTaskInstancesDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { + dagId, + dagRunId, + durationGte, + durationLte, endDateGte, endDateLte, - executorClass, - hostname, - isAlive, - jobState, - jobType, + executor, limit, + logicalDateGte, + logicalDateLte, offset, orderBy, + pool, + queue, startDateGte, startDateLte, + state, + taskId, + updatedAtGte, + updatedAtLte, }: { + dagId: string; + dagRunId: string; + durationGte?: number; + durationLte?: number; endDateGte?: string; endDateLte?: string; - executorClass?: string; - hostname?: string; - isAlive?: boolean; - jobState?: string; - jobType?: string; + executor?: string[]; limit?: number; + logicalDateGte?: string; + logicalDateLte?: string; offset?: number; orderBy?: string; + pool?: string[]; + queue?: string[]; startDateGte?: string; startDateLte?: string; - } = {}, + state?: string[]; + taskId: string; + updatedAtGte?: string; + updatedAtLte?: string; + }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useQuery({ - queryKey: Common.UseJobServiceGetJobsKeyFn( + queryKey: Common.UseTaskInstanceServiceGetMappedTaskInstancesKeyFn( { + dagId, + dagRunId, + durationGte, + durationLte, endDateGte, endDateLte, - executorClass, - hostname, - isAlive, - jobState, - jobType, + executor, limit, + logicalDateGte, + logicalDateLte, offset, orderBy, + pool, + queue, startDateGte, startDateLte, + state, + taskId, + updatedAtGte, + updatedAtLte, }, queryKey, ), queryFn: () => - JobService.getJobs({ + TaskInstanceService.getMappedTaskInstances({ + dagId, + dagRunId, + durationGte, + durationLte, endDateGte, endDateLte, - executorClass, - hostname, - isAlive, - jobState, - jobType, + executor, limit, + logicalDateGte, + logicalDateLte, offset, orderBy, + pool, + queue, startDateGte, startDateLte, + state, + taskId, + updatedAtGte, + updatedAtLte, }) as TData, ...options, }); /** - * Get Plugins - * @param data The data for the request. - * @param data.limit - * @param data.offset - * @returns PluginCollectionResponse Successful Response - * @throws ApiError - */ -export const usePluginServiceGetPlugins = < - TData = Common.PluginServiceGetPluginsDefaultResponse, - TError = unknown, - TQueryKey extends Array = unknown[], ->( - { - limit, - offset, - }: { - limit?: number; - offset?: number; - } = {}, - queryKey?: TQueryKey, - options?: Omit, "queryKey" | "queryFn">, -) => - useQuery({ - queryKey: Common.UsePluginServiceGetPluginsKeyFn( - { limit, offset }, - queryKey, - ), - queryFn: () => PluginService.getPlugins({ limit, offset }) as TData, - ...options, - }); -/** - * Get Pool - * Get a pool. + * Get Task Instance Dependencies + * Get dependencies blocking task from getting scheduled. * @param data The data for the request. - * @param data.poolName - * @returns PoolResponse Successful Response + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @param data.mapIndex + * @returns TaskDependencyCollectionResponse Successful Response * @throws ApiError */ -export const usePoolServiceGetPool = < - TData = Common.PoolServiceGetPoolDefaultResponse, +export const useTaskInstanceServiceGetTaskInstanceDependencies = < + TData = Common.TaskInstanceServiceGetTaskInstanceDependenciesDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - poolName, + dagId, + dagRunId, + mapIndex, + taskId, }: { - poolName: string; + dagId: string; + dagRunId: string; + mapIndex: number; + taskId: string; }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useQuery({ - queryKey: Common.UsePoolServiceGetPoolKeyFn({ poolName }, queryKey), - queryFn: () => PoolService.getPool({ poolName }) as TData, - ...options, - }); -/** - * Get Pools - * Get all pools entries. - * @param data The data for the request. - * @param data.limit - * @param data.offset - * @param data.orderBy - * @returns PoolCollectionResponse Successful Response - * @throws ApiError - */ -export const usePoolServiceGetPools = < - TData = Common.PoolServiceGetPoolsDefaultResponse, - TError = unknown, - TQueryKey extends Array = unknown[], ->( - { - limit, - offset, - orderBy, - }: { - limit?: number; - offset?: number; - orderBy?: string; - } = {}, - queryKey?: TQueryKey, - options?: Omit, "queryKey" | "queryFn">, -) => - useQuery({ - queryKey: Common.UsePoolServiceGetPoolsKeyFn( - { limit, offset, orderBy }, + queryKey: Common.UseTaskInstanceServiceGetTaskInstanceDependenciesKeyFn( + { dagId, dagRunId, mapIndex, taskId }, queryKey, ), - queryFn: () => PoolService.getPools({ limit, offset, orderBy }) as TData, + queryFn: () => + TaskInstanceService.getTaskInstanceDependencies({ + dagId, + dagRunId, + mapIndex, + taskId, + }) as TData, ...options, }); /** - * Get Providers - * Get providers. + * Get Task Instance Dependencies + * Get dependencies blocking task from getting scheduled. * @param data The data for the request. - * @param data.limit - * @param data.offset - * @returns ProviderCollectionResponse Successful Response + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @param data.mapIndex + * @returns TaskDependencyCollectionResponse Successful Response * @throws ApiError */ -export const useProviderServiceGetProviders = < - TData = Common.ProviderServiceGetProvidersDefaultResponse, +export const useTaskInstanceServiceGetTaskInstanceDependencies1 = < + TData = Common.TaskInstanceServiceGetTaskInstanceDependencies1DefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - limit, - offset, + dagId, + dagRunId, + mapIndex, + taskId, }: { - limit?: number; - offset?: number; - } = {}, + dagId: string; + dagRunId: string; + mapIndex?: number; + taskId: string; + }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useQuery({ - queryKey: Common.UseProviderServiceGetProvidersKeyFn( - { limit, offset }, + queryKey: Common.UseTaskInstanceServiceGetTaskInstanceDependencies1KeyFn( + { dagId, dagRunId, mapIndex, taskId }, queryKey, ), - queryFn: () => ProviderService.getProviders({ limit, offset }) as TData, + queryFn: () => + TaskInstanceService.getTaskInstanceDependencies1({ + dagId, + dagRunId, + mapIndex, + taskId, + }) as TData, ...options, }); /** - * Get Task Instance + * Get Mapped Task Instance * Get task instance. * @param data The data for the request. * @param data.dagId * @param data.dagRunId * @param data.taskId + * @param data.mapIndex * @returns TaskInstanceResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetTaskInstance = < - TData = Common.TaskInstanceServiceGetTaskInstanceDefaultResponse, +export const useTaskInstanceServiceGetMappedTaskInstance = < + TData = Common.TaskInstanceServiceGetMappedTaskInstanceDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { dagId, dagRunId, + mapIndex, taskId, }: { dagId: string; dagRunId: string; + mapIndex: number; taskId: string; }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useQuery({ - queryKey: Common.UseTaskInstanceServiceGetTaskInstanceKeyFn( - { dagId, dagRunId, taskId }, + queryKey: Common.UseTaskInstanceServiceGetMappedTaskInstanceKeyFn( + { dagId, dagRunId, mapIndex, taskId }, queryKey, ), queryFn: () => - TaskInstanceService.getTaskInstance({ dagId, dagRunId, taskId }) as TData, + TaskInstanceService.getMappedTaskInstance({ + dagId, + dagRunId, + mapIndex, + taskId, + }) as TData, ...options, }); /** - * Get Mapped Task Instances - * Get list of mapped task instances. + * Get Task Instances + * Get list of task instances. + * + * This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve Task Instances for all DAGs + * and DAG runs. * @param data The data for the request. * @param data.dagId * @param data.dagRunId - * @param data.taskId * @param data.logicalDateGte * @param data.logicalDateLte * @param data.startDateGte @@ -1560,8 +1617,8 @@ export const useTaskInstanceServiceGetTaskInstance = < * @returns TaskInstanceCollectionResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetMappedTaskInstances = < - TData = Common.TaskInstanceServiceGetMappedTaskInstancesDefaultResponse, +export const useTaskInstanceServiceGetTaskInstances = < + TData = Common.TaskInstanceServiceGetTaskInstancesDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( @@ -1583,7 +1640,6 @@ export const useTaskInstanceServiceGetMappedTaskInstances = < startDateGte, startDateLte, state, - taskId, updatedAtGte, updatedAtLte, }: { @@ -1604,7 +1660,6 @@ export const useTaskInstanceServiceGetMappedTaskInstances = < startDateGte?: string; startDateLte?: string; state?: string[]; - taskId: string; updatedAtGte?: string; updatedAtLte?: string; }, @@ -1612,7 +1667,7 @@ export const useTaskInstanceServiceGetMappedTaskInstances = < options?: Omit, "queryKey" | "queryFn">, ) => useQuery({ - queryKey: Common.UseTaskInstanceServiceGetMappedTaskInstancesKeyFn( + queryKey: Common.UseTaskInstanceServiceGetTaskInstancesKeyFn( { dagId, dagRunId, @@ -1631,14 +1686,13 @@ export const useTaskInstanceServiceGetMappedTaskInstances = < startDateGte, startDateLte, state, - taskId, updatedAtGte, updatedAtLte, }, queryKey, ), queryFn: () => - TaskInstanceService.getMappedTaskInstances({ + TaskInstanceService.getTaskInstances({ dagId, dagRunId, durationGte, @@ -1656,433 +1710,452 @@ export const useTaskInstanceServiceGetMappedTaskInstances = < startDateGte, startDateLte, state, - taskId, updatedAtGte, updatedAtLte, }) as TData, ...options, }); /** - * Get Task Instance Dependencies - * Get dependencies blocking task from getting scheduled. + * Get Task Instance Try Details + * Get task instance details by try number. * @param data The data for the request. * @param data.dagId * @param data.dagRunId * @param data.taskId + * @param data.taskTryNumber * @param data.mapIndex - * @returns TaskDependencyCollectionResponse Successful Response + * @returns TaskInstanceHistoryResponse Successful Response + * @throws ApiError + */ +export const useTaskInstanceServiceGetTaskInstanceTryDetails = < + TData = Common.TaskInstanceServiceGetTaskInstanceTryDetailsDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + dagId, + dagRunId, + mapIndex, + taskId, + taskTryNumber, + }: { + dagId: string; + dagRunId: string; + mapIndex?: number; + taskId: string; + taskTryNumber: number; + }, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useQuery({ + queryKey: Common.UseTaskInstanceServiceGetTaskInstanceTryDetailsKeyFn( + { dagId, dagRunId, mapIndex, taskId, taskTryNumber }, + queryKey, + ), + queryFn: () => + TaskInstanceService.getTaskInstanceTryDetails({ + dagId, + dagRunId, + mapIndex, + taskId, + taskTryNumber, + }) as TData, + ...options, + }); +/** + * Get Mapped Task Instance Try Details + * @param data The data for the request. + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @param data.taskTryNumber + * @param data.mapIndex + * @returns TaskInstanceHistoryResponse Successful Response + * @throws ApiError + */ +export const useTaskInstanceServiceGetMappedTaskInstanceTryDetails = < + TData = Common.TaskInstanceServiceGetMappedTaskInstanceTryDetailsDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + dagId, + dagRunId, + mapIndex, + taskId, + taskTryNumber, + }: { + dagId: string; + dagRunId: string; + mapIndex: number; + taskId: string; + taskTryNumber: number; + }, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useQuery({ + queryKey: Common.UseTaskInstanceServiceGetMappedTaskInstanceTryDetailsKeyFn( + { dagId, dagRunId, mapIndex, taskId, taskTryNumber }, + queryKey, + ), + queryFn: () => + TaskInstanceService.getMappedTaskInstanceTryDetails({ + dagId, + dagRunId, + mapIndex, + taskId, + taskTryNumber, + }) as TData, + ...options, + }); +/** + * Get Log + * Get logs for a specific task instance. + * @param data The data for the request. + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @param data.tryNumber + * @param data.fullContent + * @param data.mapIndex + * @param data.token + * @param data.accept + * @returns TaskInstancesLogResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetTaskInstanceDependencies = < - TData = Common.TaskInstanceServiceGetTaskInstanceDependenciesDefaultResponse, +export const useTaskInstanceServiceGetLog = < + TData = Common.TaskInstanceServiceGetLogDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { + accept, dagId, dagRunId, + fullContent, mapIndex, taskId, + token, + tryNumber, }: { + accept?: "application/json" | "text/plain" | "*/*"; dagId: string; dagRunId: string; - mapIndex: number; + fullContent?: boolean; + mapIndex?: number; taskId: string; + token?: string; + tryNumber: number; }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useQuery({ - queryKey: Common.UseTaskInstanceServiceGetTaskInstanceDependenciesKeyFn( - { dagId, dagRunId, mapIndex, taskId }, + queryKey: Common.UseTaskInstanceServiceGetLogKeyFn( + { + accept, + dagId, + dagRunId, + fullContent, + mapIndex, + taskId, + token, + tryNumber, + }, queryKey, ), queryFn: () => - TaskInstanceService.getTaskInstanceDependencies({ + TaskInstanceService.getLog({ + accept, dagId, dagRunId, + fullContent, mapIndex, taskId, + token, + tryNumber, }) as TData, ...options, }); /** - * Get Task Instance Dependencies - * Get dependencies blocking task from getting scheduled. + * Get Import Error + * Get an import error. * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId - * @param data.taskId - * @param data.mapIndex - * @returns TaskDependencyCollectionResponse Successful Response + * @param data.importErrorId + * @returns ImportErrorResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetTaskInstanceDependencies1 = < - TData = Common.TaskInstanceServiceGetTaskInstanceDependencies1DefaultResponse, +export const useImportErrorServiceGetImportError = < + TData = Common.ImportErrorServiceGetImportErrorDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - dagId, - dagRunId, - mapIndex, - taskId, + importErrorId, }: { - dagId: string; - dagRunId: string; - mapIndex?: number; - taskId: string; + importErrorId: number; }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useQuery({ - queryKey: Common.UseTaskInstanceServiceGetTaskInstanceDependencies1KeyFn( - { dagId, dagRunId, mapIndex, taskId }, + queryKey: Common.UseImportErrorServiceGetImportErrorKeyFn( + { importErrorId }, queryKey, ), queryFn: () => - TaskInstanceService.getTaskInstanceDependencies1({ - dagId, - dagRunId, - mapIndex, - taskId, - }) as TData, + ImportErrorService.getImportError({ importErrorId }) as TData, ...options, }); /** - * Get Mapped Task Instance - * Get task instance. + * Get Import Errors + * Get all import errors. * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId - * @param data.taskId - * @param data.mapIndex - * @returns TaskInstanceResponse Successful Response + * @param data.limit + * @param data.offset + * @param data.orderBy + * @returns ImportErrorCollectionResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetMappedTaskInstance = < - TData = Common.TaskInstanceServiceGetMappedTaskInstanceDefaultResponse, +export const useImportErrorServiceGetImportErrors = < + TData = Common.ImportErrorServiceGetImportErrorsDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - dagId, - dagRunId, - mapIndex, - taskId, + limit, + offset, + orderBy, }: { - dagId: string; - dagRunId: string; - mapIndex: number; - taskId: string; - }, + limit?: number; + offset?: number; + orderBy?: string; + } = {}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useQuery({ - queryKey: Common.UseTaskInstanceServiceGetMappedTaskInstanceKeyFn( - { dagId, dagRunId, mapIndex, taskId }, + queryKey: Common.UseImportErrorServiceGetImportErrorsKeyFn( + { limit, offset, orderBy }, queryKey, ), queryFn: () => - TaskInstanceService.getMappedTaskInstance({ - dagId, - dagRunId, - mapIndex, - taskId, - }) as TData, + ImportErrorService.getImportErrors({ limit, offset, orderBy }) as TData, ...options, }); /** - * Get Task Instances - * Get list of task instances. - * - * This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve Task Instances for all DAGs - * and DAG runs. + * Get Jobs + * Get all jobs. * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId - * @param data.logicalDateGte - * @param data.logicalDateLte + * @param data.isAlive * @param data.startDateGte * @param data.startDateLte * @param data.endDateGte * @param data.endDateLte - * @param data.updatedAtGte - * @param data.updatedAtLte - * @param data.durationGte - * @param data.durationLte - * @param data.state - * @param data.pool - * @param data.queue - * @param data.executor * @param data.limit * @param data.offset * @param data.orderBy - * @returns TaskInstanceCollectionResponse Successful Response + * @param data.jobState + * @param data.jobType + * @param data.hostname + * @param data.executorClass + * @returns JobCollectionResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetTaskInstances = < - TData = Common.TaskInstanceServiceGetTaskInstancesDefaultResponse, +export const useJobServiceGetJobs = < + TData = Common.JobServiceGetJobsDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - dagId, - dagRunId, - durationGte, - durationLte, endDateGte, endDateLte, - executor, + executorClass, + hostname, + isAlive, + jobState, + jobType, limit, - logicalDateGte, - logicalDateLte, offset, orderBy, - pool, - queue, startDateGte, startDateLte, - state, - updatedAtGte, - updatedAtLte, }: { - dagId: string; - dagRunId: string; - durationGte?: number; - durationLte?: number; endDateGte?: string; endDateLte?: string; - executor?: string[]; + executorClass?: string; + hostname?: string; + isAlive?: boolean; + jobState?: string; + jobType?: string; limit?: number; - logicalDateGte?: string; - logicalDateLte?: string; offset?: number; orderBy?: string; - pool?: string[]; - queue?: string[]; startDateGte?: string; startDateLte?: string; - state?: string[]; - updatedAtGte?: string; - updatedAtLte?: string; - }, + } = {}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useQuery({ - queryKey: Common.UseTaskInstanceServiceGetTaskInstancesKeyFn( + queryKey: Common.UseJobServiceGetJobsKeyFn( { - dagId, - dagRunId, - durationGte, - durationLte, endDateGte, endDateLte, - executor, + executorClass, + hostname, + isAlive, + jobState, + jobType, limit, - logicalDateGte, - logicalDateLte, offset, orderBy, - pool, - queue, startDateGte, startDateLte, - state, - updatedAtGte, - updatedAtLte, }, queryKey, ), queryFn: () => - TaskInstanceService.getTaskInstances({ - dagId, - dagRunId, - durationGte, - durationLte, + JobService.getJobs({ endDateGte, endDateLte, - executor, + executorClass, + hostname, + isAlive, + jobState, + jobType, limit, - logicalDateGte, - logicalDateLte, offset, orderBy, - pool, - queue, startDateGte, startDateLte, - state, - updatedAtGte, - updatedAtLte, }) as TData, ...options, }); /** - * Get Task Instance Try Details - * Get task instance details by try number. + * Get Plugins * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId - * @param data.taskId - * @param data.taskTryNumber - * @param data.mapIndex - * @returns TaskInstanceHistoryResponse Successful Response + * @param data.limit + * @param data.offset + * @returns PluginCollectionResponse Successful Response + * @throws ApiError + */ +export const usePluginServiceGetPlugins = < + TData = Common.PluginServiceGetPluginsDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + limit, + offset, + }: { + limit?: number; + offset?: number; + } = {}, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useQuery({ + queryKey: Common.UsePluginServiceGetPluginsKeyFn( + { limit, offset }, + queryKey, + ), + queryFn: () => PluginService.getPlugins({ limit, offset }) as TData, + ...options, + }); +/** + * Get Pool + * Get a pool. + * @param data The data for the request. + * @param data.poolName + * @returns PoolResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetTaskInstanceTryDetails = < - TData = Common.TaskInstanceServiceGetTaskInstanceTryDetailsDefaultResponse, +export const usePoolServiceGetPool = < + TData = Common.PoolServiceGetPoolDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - dagId, - dagRunId, - mapIndex, - taskId, - taskTryNumber, + poolName, }: { - dagId: string; - dagRunId: string; - mapIndex?: number; - taskId: string; - taskTryNumber: number; + poolName: string; }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useQuery({ - queryKey: Common.UseTaskInstanceServiceGetTaskInstanceTryDetailsKeyFn( - { dagId, dagRunId, mapIndex, taskId, taskTryNumber }, - queryKey, - ), - queryFn: () => - TaskInstanceService.getTaskInstanceTryDetails({ - dagId, - dagRunId, - mapIndex, - taskId, - taskTryNumber, - }) as TData, + queryKey: Common.UsePoolServiceGetPoolKeyFn({ poolName }, queryKey), + queryFn: () => PoolService.getPool({ poolName }) as TData, ...options, }); /** - * Get Mapped Task Instance Try Details + * Get Pools + * Get all pools entries. * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId - * @param data.taskId - * @param data.taskTryNumber - * @param data.mapIndex - * @returns TaskInstanceHistoryResponse Successful Response + * @param data.limit + * @param data.offset + * @param data.orderBy + * @returns PoolCollectionResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetMappedTaskInstanceTryDetails = < - TData = Common.TaskInstanceServiceGetMappedTaskInstanceTryDetailsDefaultResponse, +export const usePoolServiceGetPools = < + TData = Common.PoolServiceGetPoolsDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - dagId, - dagRunId, - mapIndex, - taskId, - taskTryNumber, + limit, + offset, + orderBy, }: { - dagId: string; - dagRunId: string; - mapIndex: number; - taskId: string; - taskTryNumber: number; - }, + limit?: number; + offset?: number; + orderBy?: string; + } = {}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useQuery({ - queryKey: Common.UseTaskInstanceServiceGetMappedTaskInstanceTryDetailsKeyFn( - { dagId, dagRunId, mapIndex, taskId, taskTryNumber }, + queryKey: Common.UsePoolServiceGetPoolsKeyFn( + { limit, offset, orderBy }, queryKey, ), - queryFn: () => - TaskInstanceService.getMappedTaskInstanceTryDetails({ - dagId, - dagRunId, - mapIndex, - taskId, - taskTryNumber, - }) as TData, + queryFn: () => PoolService.getPools({ limit, offset, orderBy }) as TData, ...options, }); /** - * Get Log - * Get logs for a specific task instance. + * Get Providers + * Get providers. * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId - * @param data.taskId - * @param data.tryNumber - * @param data.fullContent - * @param data.mapIndex - * @param data.token - * @param data.accept - * @returns TaskInstancesLogResponse Successful Response + * @param data.limit + * @param data.offset + * @returns ProviderCollectionResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetLog = < - TData = Common.TaskInstanceServiceGetLogDefaultResponse, +export const useProviderServiceGetProviders = < + TData = Common.ProviderServiceGetProvidersDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - accept, - dagId, - dagRunId, - fullContent, - mapIndex, - taskId, - token, - tryNumber, + limit, + offset, }: { - accept?: "application/json" | "text/plain" | "*/*"; - dagId: string; - dagRunId: string; - fullContent?: boolean; - mapIndex?: number; - taskId: string; - token?: string; - tryNumber: number; - }, + limit?: number; + offset?: number; + } = {}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useQuery({ - queryKey: Common.UseTaskInstanceServiceGetLogKeyFn( - { - accept, - dagId, - dagRunId, - fullContent, - mapIndex, - taskId, - token, - tryNumber, - }, + queryKey: Common.UseProviderServiceGetProvidersKeyFn( + { limit, offset }, queryKey, ), - queryFn: () => - TaskInstanceService.getLog({ - accept, - dagId, - dagRunId, - fullContent, - mapIndex, - taskId, - token, - tryNumber, - }) as TData, + queryFn: () => ProviderService.getProviders({ limit, offset }) as TData, ...options, }); /** @@ -2507,15 +2580,17 @@ export const useDagRunServiceClearDagRun = < ...options, }); /** - * Post Pool - * Create a Pool. + * Get Task Instances Batch + * Get list of task instances. * @param data The data for the request. + * @param data.dagId + * @param data.dagRunId * @param data.requestBody - * @returns PoolResponse Successful Response + * @returns TaskInstanceCollectionResponse Successful Response * @throws ApiError */ -export const usePoolServicePostPool = < - TData = Common.PoolServicePostPoolMutationResult, +export const useTaskInstanceServiceGetTaskInstancesBatch = < + TData = Common.TaskInstanceServiceGetTaskInstancesBatchMutationResult, TError = unknown, TContext = unknown, >( @@ -2524,7 +2599,9 @@ export const usePoolServicePostPool = < TData, TError, { - requestBody: PoolPostBody; + dagId: "~"; + dagRunId: "~"; + requestBody: TaskInstancesBatchBody; }, TContext >, @@ -2535,24 +2612,31 @@ export const usePoolServicePostPool = < TData, TError, { - requestBody: PoolPostBody; + dagId: "~"; + dagRunId: "~"; + requestBody: TaskInstancesBatchBody; }, TContext >({ - mutationFn: ({ requestBody }) => - PoolService.postPool({ requestBody }) as unknown as Promise, + mutationFn: ({ dagId, dagRunId, requestBody }) => + TaskInstanceService.getTaskInstancesBatch({ + dagId, + dagRunId, + requestBody, + }) as unknown as Promise, ...options, }); /** - * Post Pools - * Create multiple pools. + * Post Clear Task Instances + * Clear task instances. * @param data The data for the request. + * @param data.dagId * @param data.requestBody - * @returns PoolCollectionResponse Successful Response + * @returns TaskInstanceReferenceCollectionResponse Successful Response * @throws ApiError */ -export const usePoolServicePostPools = < - TData = Common.PoolServicePostPoolsMutationResult, +export const useTaskInstanceServicePostClearTaskInstances = < + TData = Common.TaskInstanceServicePostClearTaskInstancesMutationResult, TError = unknown, TContext = unknown, >( @@ -2561,7 +2645,8 @@ export const usePoolServicePostPools = < TData, TError, { - requestBody: PoolPostBulkBody; + dagId: string; + requestBody: ClearTaskInstancesBody; }, TContext >, @@ -2572,26 +2657,28 @@ export const usePoolServicePostPools = < TData, TError, { - requestBody: PoolPostBulkBody; + dagId: string; + requestBody: ClearTaskInstancesBody; }, TContext >({ - mutationFn: ({ requestBody }) => - PoolService.postPools({ requestBody }) as unknown as Promise, + mutationFn: ({ dagId, requestBody }) => + TaskInstanceService.postClearTaskInstances({ + dagId, + requestBody, + }) as unknown as Promise, ...options, }); /** - * Get Task Instances Batch - * Get list of task instances. + * Post Pool + * Create a Pool. * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId * @param data.requestBody - * @returns TaskInstanceCollectionResponse Successful Response + * @returns PoolResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetTaskInstancesBatch = < - TData = Common.TaskInstanceServiceGetTaskInstancesBatchMutationResult, +export const usePoolServicePostPool = < + TData = Common.PoolServicePostPoolMutationResult, TError = unknown, TContext = unknown, >( @@ -2600,9 +2687,7 @@ export const useTaskInstanceServiceGetTaskInstancesBatch = < TData, TError, { - dagId: "~"; - dagRunId: "~"; - requestBody: TaskInstancesBatchBody; + requestBody: PoolPostBody; }, TContext >, @@ -2613,31 +2698,24 @@ export const useTaskInstanceServiceGetTaskInstancesBatch = < TData, TError, { - dagId: "~"; - dagRunId: "~"; - requestBody: TaskInstancesBatchBody; + requestBody: PoolPostBody; }, TContext >({ - mutationFn: ({ dagId, dagRunId, requestBody }) => - TaskInstanceService.getTaskInstancesBatch({ - dagId, - dagRunId, - requestBody, - }) as unknown as Promise, + mutationFn: ({ requestBody }) => + PoolService.postPool({ requestBody }) as unknown as Promise, ...options, }); /** - * Post Clear Task Instances - * Clear task instances. + * Post Pools + * Create multiple pools. * @param data The data for the request. - * @param data.dagId * @param data.requestBody - * @returns TaskInstanceReferenceCollectionResponse Successful Response + * @returns PoolCollectionResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServicePostClearTaskInstances = < - TData = Common.TaskInstanceServicePostClearTaskInstancesMutationResult, +export const usePoolServicePostPools = < + TData = Common.PoolServicePostPoolsMutationResult, TError = unknown, TContext = unknown, >( @@ -2646,8 +2724,7 @@ export const useTaskInstanceServicePostClearTaskInstances = < TData, TError, { - dagId: string; - requestBody: ClearTaskInstancesBody; + requestBody: PoolPostBulkBody; }, TContext >, @@ -2658,16 +2735,12 @@ export const useTaskInstanceServicePostClearTaskInstances = < TData, TError, { - dagId: string; - requestBody: ClearTaskInstancesBody; + requestBody: PoolPostBulkBody; }, TContext >({ - mutationFn: ({ dagId, requestBody }) => - TaskInstanceService.postClearTaskInstances({ - dagId, - requestBody, - }) as unknown as Promise, + mutationFn: ({ requestBody }) => + PoolService.postPools({ requestBody }) as unknown as Promise, ...options, }); /** diff --git a/airflow/ui/openapi-gen/queries/suspense.ts b/airflow/ui/openapi-gen/queries/suspense.ts index d8175414ac3d8..6027b5e39e075 100644 --- a/airflow/ui/openapi-gen/queries/suspense.ts +++ b/airflow/ui/openapi-gen/queries/suspense.ts @@ -14,6 +14,7 @@ import { DagsService, DashboardService, EventLogService, + ExtraLinksService, ImportErrorService, JobService, MonitorService, @@ -1199,327 +1200,383 @@ export const useEventLogServiceGetEventLogsSuspense = < ...options, }); /** - * Get Import Error - * Get an import error. + * Get Extra Links + * Get extra links for task instance. * @param data The data for the request. - * @param data.importErrorId - * @returns ImportErrorResponse Successful Response + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @returns ExtraLinksResponse Successful Response * @throws ApiError */ -export const useImportErrorServiceGetImportErrorSuspense = < - TData = Common.ImportErrorServiceGetImportErrorDefaultResponse, +export const useExtraLinksServiceGetExtraLinksSuspense = < + TData = Common.ExtraLinksServiceGetExtraLinksDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - importErrorId, + dagId, + dagRunId, + taskId, }: { - importErrorId: number; + dagId: string; + dagRunId: string; + taskId: string; }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useSuspenseQuery({ - queryKey: Common.UseImportErrorServiceGetImportErrorKeyFn( - { importErrorId }, + queryKey: Common.UseExtraLinksServiceGetExtraLinksKeyFn( + { dagId, dagRunId, taskId }, queryKey, ), queryFn: () => - ImportErrorService.getImportError({ importErrorId }) as TData, + ExtraLinksService.getExtraLinks({ dagId, dagRunId, taskId }) as TData, ...options, }); /** - * Get Import Errors - * Get all import errors. + * Get Extra Links + * Get extra links for task instance. * @param data The data for the request. - * @param data.limit - * @param data.offset - * @param data.orderBy - * @returns ImportErrorCollectionResponse Successful Response + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @returns ExtraLinksResponse Successful Response * @throws ApiError */ -export const useImportErrorServiceGetImportErrorsSuspense = < - TData = Common.ImportErrorServiceGetImportErrorsDefaultResponse, +export const useTaskInstanceServiceGetExtraLinksSuspense = < + TData = Common.TaskInstanceServiceGetExtraLinksDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - limit, - offset, - orderBy, + dagId, + dagRunId, + taskId, }: { - limit?: number; - offset?: number; - orderBy?: string; - } = {}, + dagId: string; + dagRunId: string; + taskId: string; + }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useSuspenseQuery({ - queryKey: Common.UseImportErrorServiceGetImportErrorsKeyFn( - { limit, offset, orderBy }, + queryKey: Common.UseTaskInstanceServiceGetExtraLinksKeyFn( + { dagId, dagRunId, taskId }, queryKey, ), queryFn: () => - ImportErrorService.getImportErrors({ limit, offset, orderBy }) as TData, + TaskInstanceService.getExtraLinks({ dagId, dagRunId, taskId }) as TData, ...options, }); /** - * Get Jobs - * Get all jobs. + * Get Task Instance + * Get task instance. * @param data The data for the request. - * @param data.isAlive + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @returns TaskInstanceResponse Successful Response + * @throws ApiError + */ +export const useTaskInstanceServiceGetTaskInstanceSuspense = < + TData = Common.TaskInstanceServiceGetTaskInstanceDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + dagId, + dagRunId, + taskId, + }: { + dagId: string; + dagRunId: string; + taskId: string; + }, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useSuspenseQuery({ + queryKey: Common.UseTaskInstanceServiceGetTaskInstanceKeyFn( + { dagId, dagRunId, taskId }, + queryKey, + ), + queryFn: () => + TaskInstanceService.getTaskInstance({ dagId, dagRunId, taskId }) as TData, + ...options, + }); +/** + * Get Mapped Task Instances + * Get list of mapped task instances. + * @param data The data for the request. + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @param data.logicalDateGte + * @param data.logicalDateLte * @param data.startDateGte * @param data.startDateLte * @param data.endDateGte * @param data.endDateLte + * @param data.updatedAtGte + * @param data.updatedAtLte + * @param data.durationGte + * @param data.durationLte + * @param data.state + * @param data.pool + * @param data.queue + * @param data.executor * @param data.limit * @param data.offset * @param data.orderBy - * @param data.jobState - * @param data.jobType - * @param data.hostname - * @param data.executorClass - * @returns JobCollectionResponse Successful Response + * @returns TaskInstanceCollectionResponse Successful Response * @throws ApiError */ -export const useJobServiceGetJobsSuspense = < - TData = Common.JobServiceGetJobsDefaultResponse, +export const useTaskInstanceServiceGetMappedTaskInstancesSuspense = < + TData = Common.TaskInstanceServiceGetMappedTaskInstancesDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { + dagId, + dagRunId, + durationGte, + durationLte, endDateGte, endDateLte, - executorClass, - hostname, - isAlive, - jobState, - jobType, + executor, limit, + logicalDateGte, + logicalDateLte, offset, orderBy, + pool, + queue, startDateGte, startDateLte, + state, + taskId, + updatedAtGte, + updatedAtLte, }: { + dagId: string; + dagRunId: string; + durationGte?: number; + durationLte?: number; endDateGte?: string; endDateLte?: string; - executorClass?: string; - hostname?: string; - isAlive?: boolean; - jobState?: string; - jobType?: string; + executor?: string[]; limit?: number; + logicalDateGte?: string; + logicalDateLte?: string; offset?: number; orderBy?: string; + pool?: string[]; + queue?: string[]; startDateGte?: string; startDateLte?: string; - } = {}, + state?: string[]; + taskId: string; + updatedAtGte?: string; + updatedAtLte?: string; + }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useSuspenseQuery({ - queryKey: Common.UseJobServiceGetJobsKeyFn( + queryKey: Common.UseTaskInstanceServiceGetMappedTaskInstancesKeyFn( { + dagId, + dagRunId, + durationGte, + durationLte, endDateGte, endDateLte, - executorClass, - hostname, - isAlive, - jobState, - jobType, + executor, limit, + logicalDateGte, + logicalDateLte, offset, orderBy, + pool, + queue, startDateGte, startDateLte, + state, + taskId, + updatedAtGte, + updatedAtLte, }, queryKey, ), queryFn: () => - JobService.getJobs({ + TaskInstanceService.getMappedTaskInstances({ + dagId, + dagRunId, + durationGte, + durationLte, endDateGte, endDateLte, - executorClass, - hostname, - isAlive, - jobState, - jobType, + executor, limit, + logicalDateGte, + logicalDateLte, offset, orderBy, + pool, + queue, startDateGte, startDateLte, + state, + taskId, + updatedAtGte, + updatedAtLte, }) as TData, ...options, }); /** - * Get Plugins + * Get Task Instance Dependencies + * Get dependencies blocking task from getting scheduled. * @param data The data for the request. - * @param data.limit - * @param data.offset - * @returns PluginCollectionResponse Successful Response + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @param data.mapIndex + * @returns TaskDependencyCollectionResponse Successful Response * @throws ApiError */ -export const usePluginServiceGetPluginsSuspense = < - TData = Common.PluginServiceGetPluginsDefaultResponse, +export const useTaskInstanceServiceGetTaskInstanceDependenciesSuspense = < + TData = Common.TaskInstanceServiceGetTaskInstanceDependenciesDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - limit, - offset, + dagId, + dagRunId, + mapIndex, + taskId, }: { - limit?: number; - offset?: number; - } = {}, + dagId: string; + dagRunId: string; + mapIndex: number; + taskId: string; + }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useSuspenseQuery({ - queryKey: Common.UsePluginServiceGetPluginsKeyFn( - { limit, offset }, + queryKey: Common.UseTaskInstanceServiceGetTaskInstanceDependenciesKeyFn( + { dagId, dagRunId, mapIndex, taskId }, queryKey, ), - queryFn: () => PluginService.getPlugins({ limit, offset }) as TData, + queryFn: () => + TaskInstanceService.getTaskInstanceDependencies({ + dagId, + dagRunId, + mapIndex, + taskId, + }) as TData, ...options, }); /** - * Get Pool - * Get a pool. + * Get Task Instance Dependencies + * Get dependencies blocking task from getting scheduled. * @param data The data for the request. - * @param data.poolName - * @returns PoolResponse Successful Response + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @param data.mapIndex + * @returns TaskDependencyCollectionResponse Successful Response * @throws ApiError */ -export const usePoolServiceGetPoolSuspense = < - TData = Common.PoolServiceGetPoolDefaultResponse, +export const useTaskInstanceServiceGetTaskInstanceDependencies1Suspense = < + TData = Common.TaskInstanceServiceGetTaskInstanceDependencies1DefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - poolName, + dagId, + dagRunId, + mapIndex, + taskId, }: { - poolName: string; - }, - queryKey?: TQueryKey, - options?: Omit, "queryKey" | "queryFn">, -) => - useSuspenseQuery({ - queryKey: Common.UsePoolServiceGetPoolKeyFn({ poolName }, queryKey), - queryFn: () => PoolService.getPool({ poolName }) as TData, - ...options, - }); -/** - * Get Pools - * Get all pools entries. - * @param data The data for the request. - * @param data.limit - * @param data.offset - * @param data.orderBy - * @returns PoolCollectionResponse Successful Response - * @throws ApiError - */ -export const usePoolServiceGetPoolsSuspense = < - TData = Common.PoolServiceGetPoolsDefaultResponse, - TError = unknown, - TQueryKey extends Array = unknown[], ->( - { - limit, - offset, - orderBy, - }: { - limit?: number; - offset?: number; - orderBy?: string; - } = {}, - queryKey?: TQueryKey, - options?: Omit, "queryKey" | "queryFn">, -) => - useSuspenseQuery({ - queryKey: Common.UsePoolServiceGetPoolsKeyFn( - { limit, offset, orderBy }, - queryKey, - ), - queryFn: () => PoolService.getPools({ limit, offset, orderBy }) as TData, - ...options, - }); -/** - * Get Providers - * Get providers. - * @param data The data for the request. - * @param data.limit - * @param data.offset - * @returns ProviderCollectionResponse Successful Response - * @throws ApiError - */ -export const useProviderServiceGetProvidersSuspense = < - TData = Common.ProviderServiceGetProvidersDefaultResponse, - TError = unknown, - TQueryKey extends Array = unknown[], ->( - { - limit, - offset, - }: { - limit?: number; - offset?: number; - } = {}, + dagId: string; + dagRunId: string; + mapIndex?: number; + taskId: string; + }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useSuspenseQuery({ - queryKey: Common.UseProviderServiceGetProvidersKeyFn( - { limit, offset }, + queryKey: Common.UseTaskInstanceServiceGetTaskInstanceDependencies1KeyFn( + { dagId, dagRunId, mapIndex, taskId }, queryKey, ), - queryFn: () => ProviderService.getProviders({ limit, offset }) as TData, + queryFn: () => + TaskInstanceService.getTaskInstanceDependencies1({ + dagId, + dagRunId, + mapIndex, + taskId, + }) as TData, ...options, }); /** - * Get Task Instance + * Get Mapped Task Instance * Get task instance. * @param data The data for the request. * @param data.dagId * @param data.dagRunId * @param data.taskId + * @param data.mapIndex * @returns TaskInstanceResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetTaskInstanceSuspense = < - TData = Common.TaskInstanceServiceGetTaskInstanceDefaultResponse, +export const useTaskInstanceServiceGetMappedTaskInstanceSuspense = < + TData = Common.TaskInstanceServiceGetMappedTaskInstanceDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { dagId, dagRunId, + mapIndex, taskId, }: { dagId: string; dagRunId: string; + mapIndex: number; taskId: string; }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useSuspenseQuery({ - queryKey: Common.UseTaskInstanceServiceGetTaskInstanceKeyFn( - { dagId, dagRunId, taskId }, + queryKey: Common.UseTaskInstanceServiceGetMappedTaskInstanceKeyFn( + { dagId, dagRunId, mapIndex, taskId }, queryKey, ), queryFn: () => - TaskInstanceService.getTaskInstance({ dagId, dagRunId, taskId }) as TData, + TaskInstanceService.getMappedTaskInstance({ + dagId, + dagRunId, + mapIndex, + taskId, + }) as TData, ...options, }); /** - * Get Mapped Task Instances - * Get list of mapped task instances. + * Get Task Instances + * Get list of task instances. + * + * This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve Task Instances for all DAGs + * and DAG runs. * @param data The data for the request. * @param data.dagId * @param data.dagRunId - * @param data.taskId * @param data.logicalDateGte * @param data.logicalDateLte * @param data.startDateGte @@ -1540,8 +1597,8 @@ export const useTaskInstanceServiceGetTaskInstanceSuspense = < * @returns TaskInstanceCollectionResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetMappedTaskInstancesSuspense = < - TData = Common.TaskInstanceServiceGetMappedTaskInstancesDefaultResponse, +export const useTaskInstanceServiceGetTaskInstancesSuspense = < + TData = Common.TaskInstanceServiceGetTaskInstancesDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( @@ -1563,7 +1620,6 @@ export const useTaskInstanceServiceGetMappedTaskInstancesSuspense = < startDateGte, startDateLte, state, - taskId, updatedAtGte, updatedAtLte, }: { @@ -1584,7 +1640,6 @@ export const useTaskInstanceServiceGetMappedTaskInstancesSuspense = < startDateGte?: string; startDateLte?: string; state?: string[]; - taskId: string; updatedAtGte?: string; updatedAtLte?: string; }, @@ -1592,7 +1647,7 @@ export const useTaskInstanceServiceGetMappedTaskInstancesSuspense = < options?: Omit, "queryKey" | "queryFn">, ) => useSuspenseQuery({ - queryKey: Common.UseTaskInstanceServiceGetMappedTaskInstancesKeyFn( + queryKey: Common.UseTaskInstanceServiceGetTaskInstancesKeyFn( { dagId, dagRunId, @@ -1611,14 +1666,13 @@ export const useTaskInstanceServiceGetMappedTaskInstancesSuspense = < startDateGte, startDateLte, state, - taskId, updatedAtGte, updatedAtLte, }, queryKey, ), queryFn: () => - TaskInstanceService.getMappedTaskInstances({ + TaskInstanceService.getTaskInstances({ dagId, dagRunId, durationGte, @@ -1636,25 +1690,25 @@ export const useTaskInstanceServiceGetMappedTaskInstancesSuspense = < startDateGte, startDateLte, state, - taskId, updatedAtGte, updatedAtLte, }) as TData, ...options, }); /** - * Get Task Instance Dependencies - * Get dependencies blocking task from getting scheduled. + * Get Task Instance Try Details + * Get task instance details by try number. * @param data The data for the request. * @param data.dagId * @param data.dagRunId * @param data.taskId + * @param data.taskTryNumber * @param data.mapIndex - * @returns TaskDependencyCollectionResponse Successful Response + * @returns TaskInstanceHistoryResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetTaskInstanceDependenciesSuspense = < - TData = Common.TaskInstanceServiceGetTaskInstanceDependenciesDefaultResponse, +export const useTaskInstanceServiceGetTaskInstanceTryDetailsSuspense = < + TData = Common.TaskInstanceServiceGetTaskInstanceTryDetailsDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( @@ -1663,42 +1717,45 @@ export const useTaskInstanceServiceGetTaskInstanceDependenciesSuspense = < dagRunId, mapIndex, taskId, + taskTryNumber, }: { dagId: string; dagRunId: string; - mapIndex: number; + mapIndex?: number; taskId: string; + taskTryNumber: number; }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useSuspenseQuery({ - queryKey: Common.UseTaskInstanceServiceGetTaskInstanceDependenciesKeyFn( - { dagId, dagRunId, mapIndex, taskId }, + queryKey: Common.UseTaskInstanceServiceGetTaskInstanceTryDetailsKeyFn( + { dagId, dagRunId, mapIndex, taskId, taskTryNumber }, queryKey, ), queryFn: () => - TaskInstanceService.getTaskInstanceDependencies({ + TaskInstanceService.getTaskInstanceTryDetails({ dagId, dagRunId, mapIndex, taskId, + taskTryNumber, }) as TData, ...options, }); /** - * Get Task Instance Dependencies - * Get dependencies blocking task from getting scheduled. + * Get Mapped Task Instance Try Details * @param data The data for the request. * @param data.dagId * @param data.dagRunId * @param data.taskId + * @param data.taskTryNumber * @param data.mapIndex - * @returns TaskDependencyCollectionResponse Successful Response + * @returns TaskInstanceHistoryResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetTaskInstanceDependencies1Suspense = < - TData = Common.TaskInstanceServiceGetTaskInstanceDependencies1DefaultResponse, +export const useTaskInstanceServiceGetMappedTaskInstanceTryDetailsSuspense = < + TData = Common.TaskInstanceServiceGetMappedTaskInstanceTryDetailsDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( @@ -1707,362 +1764,378 @@ export const useTaskInstanceServiceGetTaskInstanceDependencies1Suspense = < dagRunId, mapIndex, taskId, + taskTryNumber, }: { dagId: string; dagRunId: string; - mapIndex?: number; + mapIndex: number; taskId: string; + taskTryNumber: number; }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useSuspenseQuery({ - queryKey: Common.UseTaskInstanceServiceGetTaskInstanceDependencies1KeyFn( - { dagId, dagRunId, mapIndex, taskId }, + queryKey: Common.UseTaskInstanceServiceGetMappedTaskInstanceTryDetailsKeyFn( + { dagId, dagRunId, mapIndex, taskId, taskTryNumber }, queryKey, ), queryFn: () => - TaskInstanceService.getTaskInstanceDependencies1({ + TaskInstanceService.getMappedTaskInstanceTryDetails({ dagId, dagRunId, mapIndex, taskId, + taskTryNumber, }) as TData, ...options, }); /** - * Get Mapped Task Instance - * Get task instance. + * Get Log + * Get logs for a specific task instance. * @param data The data for the request. * @param data.dagId * @param data.dagRunId * @param data.taskId + * @param data.tryNumber + * @param data.fullContent * @param data.mapIndex - * @returns TaskInstanceResponse Successful Response + * @param data.token + * @param data.accept + * @returns TaskInstancesLogResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetMappedTaskInstanceSuspense = < - TData = Common.TaskInstanceServiceGetMappedTaskInstanceDefaultResponse, +export const useTaskInstanceServiceGetLogSuspense = < + TData = Common.TaskInstanceServiceGetLogDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { + accept, dagId, dagRunId, + fullContent, mapIndex, taskId, + token, + tryNumber, }: { + accept?: "application/json" | "text/plain" | "*/*"; dagId: string; dagRunId: string; - mapIndex: number; + fullContent?: boolean; + mapIndex?: number; taskId: string; + token?: string; + tryNumber: number; }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useSuspenseQuery({ - queryKey: Common.UseTaskInstanceServiceGetMappedTaskInstanceKeyFn( - { dagId, dagRunId, mapIndex, taskId }, + queryKey: Common.UseTaskInstanceServiceGetLogKeyFn( + { + accept, + dagId, + dagRunId, + fullContent, + mapIndex, + taskId, + token, + tryNumber, + }, queryKey, ), queryFn: () => - TaskInstanceService.getMappedTaskInstance({ + TaskInstanceService.getLog({ + accept, dagId, dagRunId, + fullContent, mapIndex, taskId, + token, + tryNumber, }) as TData, ...options, }); /** - * Get Task Instances - * Get list of task instances. - * - * This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve Task Instances for all DAGs - * and DAG runs. + * Get Import Error + * Get an import error. * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId - * @param data.logicalDateGte - * @param data.logicalDateLte - * @param data.startDateGte - * @param data.startDateLte - * @param data.endDateGte - * @param data.endDateLte - * @param data.updatedAtGte - * @param data.updatedAtLte - * @param data.durationGte - * @param data.durationLte - * @param data.state - * @param data.pool - * @param data.queue - * @param data.executor - * @param data.limit - * @param data.offset - * @param data.orderBy - * @returns TaskInstanceCollectionResponse Successful Response + * @param data.importErrorId + * @returns ImportErrorResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetTaskInstancesSuspense = < - TData = Common.TaskInstanceServiceGetTaskInstancesDefaultResponse, +export const useImportErrorServiceGetImportErrorSuspense = < + TData = Common.ImportErrorServiceGetImportErrorDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - dagId, - dagRunId, - durationGte, - durationLte, - endDateGte, - endDateLte, - executor, - limit, - logicalDateGte, - logicalDateLte, - offset, - orderBy, - pool, - queue, - startDateGte, - startDateLte, - state, - updatedAtGte, - updatedAtLte, + importErrorId, + }: { + importErrorId: number; + }, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useSuspenseQuery({ + queryKey: Common.UseImportErrorServiceGetImportErrorKeyFn( + { importErrorId }, + queryKey, + ), + queryFn: () => + ImportErrorService.getImportError({ importErrorId }) as TData, + ...options, + }); +/** + * Get Import Errors + * Get all import errors. + * @param data The data for the request. + * @param data.limit + * @param data.offset + * @param data.orderBy + * @returns ImportErrorCollectionResponse Successful Response + * @throws ApiError + */ +export const useImportErrorServiceGetImportErrorsSuspense = < + TData = Common.ImportErrorServiceGetImportErrorsDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + limit, + offset, + orderBy, + }: { + limit?: number; + offset?: number; + orderBy?: string; + } = {}, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useSuspenseQuery({ + queryKey: Common.UseImportErrorServiceGetImportErrorsKeyFn( + { limit, offset, orderBy }, + queryKey, + ), + queryFn: () => + ImportErrorService.getImportErrors({ limit, offset, orderBy }) as TData, + ...options, + }); +/** + * Get Jobs + * Get all jobs. + * @param data The data for the request. + * @param data.isAlive + * @param data.startDateGte + * @param data.startDateLte + * @param data.endDateGte + * @param data.endDateLte + * @param data.limit + * @param data.offset + * @param data.orderBy + * @param data.jobState + * @param data.jobType + * @param data.hostname + * @param data.executorClass + * @returns JobCollectionResponse Successful Response + * @throws ApiError + */ +export const useJobServiceGetJobsSuspense = < + TData = Common.JobServiceGetJobsDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + endDateGte, + endDateLte, + executorClass, + hostname, + isAlive, + jobState, + jobType, + limit, + offset, + orderBy, + startDateGte, + startDateLte, }: { - dagId: string; - dagRunId: string; - durationGte?: number; - durationLte?: number; endDateGte?: string; endDateLte?: string; - executor?: string[]; + executorClass?: string; + hostname?: string; + isAlive?: boolean; + jobState?: string; + jobType?: string; limit?: number; - logicalDateGte?: string; - logicalDateLte?: string; offset?: number; orderBy?: string; - pool?: string[]; - queue?: string[]; startDateGte?: string; startDateLte?: string; - state?: string[]; - updatedAtGte?: string; - updatedAtLte?: string; - }, + } = {}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useSuspenseQuery({ - queryKey: Common.UseTaskInstanceServiceGetTaskInstancesKeyFn( + queryKey: Common.UseJobServiceGetJobsKeyFn( { - dagId, - dagRunId, - durationGte, - durationLte, endDateGte, endDateLte, - executor, + executorClass, + hostname, + isAlive, + jobState, + jobType, limit, - logicalDateGte, - logicalDateLte, offset, orderBy, - pool, - queue, startDateGte, startDateLte, - state, - updatedAtGte, - updatedAtLte, }, queryKey, ), queryFn: () => - TaskInstanceService.getTaskInstances({ - dagId, - dagRunId, - durationGte, - durationLte, + JobService.getJobs({ endDateGte, endDateLte, - executor, + executorClass, + hostname, + isAlive, + jobState, + jobType, limit, - logicalDateGte, - logicalDateLte, offset, orderBy, - pool, - queue, startDateGte, startDateLte, - state, - updatedAtGte, - updatedAtLte, }) as TData, ...options, }); /** - * Get Task Instance Try Details - * Get task instance details by try number. + * Get Plugins * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId - * @param data.taskId - * @param data.taskTryNumber - * @param data.mapIndex - * @returns TaskInstanceHistoryResponse Successful Response + * @param data.limit + * @param data.offset + * @returns PluginCollectionResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetTaskInstanceTryDetailsSuspense = < - TData = Common.TaskInstanceServiceGetTaskInstanceTryDetailsDefaultResponse, +export const usePluginServiceGetPluginsSuspense = < + TData = Common.PluginServiceGetPluginsDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - dagId, - dagRunId, - mapIndex, - taskId, - taskTryNumber, + limit, + offset, }: { - dagId: string; - dagRunId: string; - mapIndex?: number; - taskId: string; - taskTryNumber: number; - }, + limit?: number; + offset?: number; + } = {}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useSuspenseQuery({ - queryKey: Common.UseTaskInstanceServiceGetTaskInstanceTryDetailsKeyFn( - { dagId, dagRunId, mapIndex, taskId, taskTryNumber }, + queryKey: Common.UsePluginServiceGetPluginsKeyFn( + { limit, offset }, queryKey, ), - queryFn: () => - TaskInstanceService.getTaskInstanceTryDetails({ - dagId, - dagRunId, - mapIndex, - taskId, - taskTryNumber, - }) as TData, + queryFn: () => PluginService.getPlugins({ limit, offset }) as TData, ...options, }); /** - * Get Mapped Task Instance Try Details + * Get Pool + * Get a pool. * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId - * @param data.taskId - * @param data.taskTryNumber - * @param data.mapIndex - * @returns TaskInstanceHistoryResponse Successful Response + * @param data.poolName + * @returns PoolResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetMappedTaskInstanceTryDetailsSuspense = < - TData = Common.TaskInstanceServiceGetMappedTaskInstanceTryDetailsDefaultResponse, +export const usePoolServiceGetPoolSuspense = < + TData = Common.PoolServiceGetPoolDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - dagId, - dagRunId, - mapIndex, - taskId, - taskTryNumber, + poolName, }: { - dagId: string; - dagRunId: string; - mapIndex: number; - taskId: string; - taskTryNumber: number; + poolName: string; }, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useSuspenseQuery({ - queryKey: Common.UseTaskInstanceServiceGetMappedTaskInstanceTryDetailsKeyFn( - { dagId, dagRunId, mapIndex, taskId, taskTryNumber }, + queryKey: Common.UsePoolServiceGetPoolKeyFn({ poolName }, queryKey), + queryFn: () => PoolService.getPool({ poolName }) as TData, + ...options, + }); +/** + * Get Pools + * Get all pools entries. + * @param data The data for the request. + * @param data.limit + * @param data.offset + * @param data.orderBy + * @returns PoolCollectionResponse Successful Response + * @throws ApiError + */ +export const usePoolServiceGetPoolsSuspense = < + TData = Common.PoolServiceGetPoolsDefaultResponse, + TError = unknown, + TQueryKey extends Array = unknown[], +>( + { + limit, + offset, + orderBy, + }: { + limit?: number; + offset?: number; + orderBy?: string; + } = {}, + queryKey?: TQueryKey, + options?: Omit, "queryKey" | "queryFn">, +) => + useSuspenseQuery({ + queryKey: Common.UsePoolServiceGetPoolsKeyFn( + { limit, offset, orderBy }, queryKey, ), - queryFn: () => - TaskInstanceService.getMappedTaskInstanceTryDetails({ - dagId, - dagRunId, - mapIndex, - taskId, - taskTryNumber, - }) as TData, + queryFn: () => PoolService.getPools({ limit, offset, orderBy }) as TData, ...options, }); /** - * Get Log - * Get logs for a specific task instance. + * Get Providers + * Get providers. * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId - * @param data.taskId - * @param data.tryNumber - * @param data.fullContent - * @param data.mapIndex - * @param data.token - * @param data.accept - * @returns TaskInstancesLogResponse Successful Response + * @param data.limit + * @param data.offset + * @returns ProviderCollectionResponse Successful Response * @throws ApiError */ -export const useTaskInstanceServiceGetLogSuspense = < - TData = Common.TaskInstanceServiceGetLogDefaultResponse, +export const useProviderServiceGetProvidersSuspense = < + TData = Common.ProviderServiceGetProvidersDefaultResponse, TError = unknown, TQueryKey extends Array = unknown[], >( { - accept, - dagId, - dagRunId, - fullContent, - mapIndex, - taskId, - token, - tryNumber, + limit, + offset, }: { - accept?: "application/json" | "text/plain" | "*/*"; - dagId: string; - dagRunId: string; - fullContent?: boolean; - mapIndex?: number; - taskId: string; - token?: string; - tryNumber: number; - }, + limit?: number; + offset?: number; + } = {}, queryKey?: TQueryKey, options?: Omit, "queryKey" | "queryFn">, ) => useSuspenseQuery({ - queryKey: Common.UseTaskInstanceServiceGetLogKeyFn( - { - accept, - dagId, - dagRunId, - fullContent, - mapIndex, - taskId, - token, - tryNumber, - }, + queryKey: Common.UseProviderServiceGetProvidersKeyFn( + { limit, offset }, queryKey, ), - queryFn: () => - TaskInstanceService.getLog({ - accept, - dagId, - dagRunId, - fullContent, - mapIndex, - taskId, - token, - tryNumber, - }) as TData, + queryFn: () => ProviderService.getProviders({ limit, offset }) as TData, ...options, }); /** diff --git a/airflow/ui/openapi-gen/requests/schemas.gen.ts b/airflow/ui/openapi-gen/requests/schemas.gen.ts index 5cd3e9e6b5264..8c39721e096b7 100644 --- a/airflow/ui/openapi-gen/requests/schemas.gen.ts +++ b/airflow/ui/openapi-gen/requests/schemas.gen.ts @@ -2591,6 +2591,22 @@ export const $EventLogResponse = { description: "Event Log Response.", } as const; +export const $ExtraLinksResponse = { + additionalProperties: { + anyOf: [ + { + type: "string", + }, + { + type: "null", + }, + ], + }, + type: "object", + title: "ExtraLinksResponse", + description: "Extra Links Response.", +} as const; + export const $FastAPIAppResponse = { properties: { app: { diff --git a/airflow/ui/openapi-gen/requests/services.gen.ts b/airflow/ui/openapi-gen/requests/services.gen.ts index e2bbc48437a1e..6d89566a696a9 100644 --- a/airflow/ui/openapi-gen/requests/services.gen.ts +++ b/airflow/ui/openapi-gen/requests/services.gen.ts @@ -94,28 +94,8 @@ import type { GetEventLogResponse, GetEventLogsData, GetEventLogsResponse, - GetImportErrorData, - GetImportErrorResponse, - GetImportErrorsData, - GetImportErrorsResponse, - GetJobsData, - GetJobsResponse, - GetPluginsData, - GetPluginsResponse, - DeletePoolData, - DeletePoolResponse, - GetPoolData, - GetPoolResponse, - PatchPoolData, - PatchPoolResponse, - GetPoolsData, - GetPoolsResponse, - PostPoolData, - PostPoolResponse, - PostPoolsData, - PostPoolsResponse, - GetProvidersData, - GetProvidersResponse, + GetExtraLinksData, + GetExtraLinksResponse, GetTaskInstanceData, GetTaskInstanceResponse, GetMappedTaskInstancesData, @@ -138,6 +118,28 @@ import type { PostClearTaskInstancesResponse, GetLogData, GetLogResponse, + GetImportErrorData, + GetImportErrorResponse, + GetImportErrorsData, + GetImportErrorsResponse, + GetJobsData, + GetJobsResponse, + GetPluginsData, + GetPluginsResponse, + DeletePoolData, + DeletePoolResponse, + GetPoolData, + GetPoolResponse, + PatchPoolData, + PatchPoolResponse, + GetPoolsData, + GetPoolsResponse, + PostPoolData, + PostPoolResponse, + PostPoolsData, + PostPoolsResponse, + GetProvidersData, + GetProvidersResponse, GetTasksData, GetTasksResponse, GetTaskData, @@ -1595,23 +1597,27 @@ export class EventLogService { } } -export class ImportErrorService { +export class ExtraLinksService { /** - * Get Import Error - * Get an import error. + * Get Extra Links + * Get extra links for task instance. * @param data The data for the request. - * @param data.importErrorId - * @returns ImportErrorResponse Successful Response + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @returns ExtraLinksResponse Successful Response * @throws ApiError */ - public static getImportError( - data: GetImportErrorData, - ): CancelablePromise { + public static getExtraLinks( + data: GetExtraLinksData, + ): CancelablePromise { return __request(OpenAPI, { method: "GET", - url: "/public/importErrors/{import_error_id}", + url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/links", path: { - import_error_id: data.importErrorId, + dag_id: data.dagId, + dag_run_id: data.dagRunId, + task_id: data.taskId, }, errors: { 401: "Unauthorized", @@ -1621,135 +1627,193 @@ export class ImportErrorService { }, }); } +} +export class TaskInstanceService { /** - * Get Import Errors - * Get all import errors. + * Get Extra Links + * Get extra links for task instance. * @param data The data for the request. - * @param data.limit - * @param data.offset - * @param data.orderBy - * @returns ImportErrorCollectionResponse Successful Response + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @returns ExtraLinksResponse Successful Response * @throws ApiError */ - public static getImportErrors( - data: GetImportErrorsData = {}, - ): CancelablePromise { + public static getExtraLinks( + data: GetExtraLinksData, + ): CancelablePromise { return __request(OpenAPI, { method: "GET", - url: "/public/importErrors", - query: { - limit: data.limit, - offset: data.offset, - order_by: data.orderBy, + url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/links", + path: { + dag_id: data.dagId, + dag_run_id: data.dagRunId, + task_id: data.taskId, }, errors: { 401: "Unauthorized", 403: "Forbidden", + 404: "Not Found", 422: "Validation Error", }, }); } -} -export class JobService { /** - * Get Jobs - * Get all jobs. + * Get Task Instance + * Get task instance. * @param data The data for the request. - * @param data.isAlive + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @returns TaskInstanceResponse Successful Response + * @throws ApiError + */ + public static getTaskInstance( + data: GetTaskInstanceData, + ): CancelablePromise { + return __request(OpenAPI, { + method: "GET", + url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}", + path: { + dag_id: data.dagId, + dag_run_id: data.dagRunId, + task_id: data.taskId, + }, + errors: { + 401: "Unauthorized", + 403: "Forbidden", + 404: "Not Found", + 422: "Validation Error", + }, + }); + } + + /** + * Get Mapped Task Instances + * Get list of mapped task instances. + * @param data The data for the request. + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @param data.logicalDateGte + * @param data.logicalDateLte * @param data.startDateGte * @param data.startDateLte * @param data.endDateGte * @param data.endDateLte + * @param data.updatedAtGte + * @param data.updatedAtLte + * @param data.durationGte + * @param data.durationLte + * @param data.state + * @param data.pool + * @param data.queue + * @param data.executor * @param data.limit * @param data.offset * @param data.orderBy - * @param data.jobState - * @param data.jobType - * @param data.hostname - * @param data.executorClass - * @returns JobCollectionResponse Successful Response + * @returns TaskInstanceCollectionResponse Successful Response * @throws ApiError */ - public static getJobs( - data: GetJobsData = {}, - ): CancelablePromise { + public static getMappedTaskInstances( + data: GetMappedTaskInstancesData, + ): CancelablePromise { return __request(OpenAPI, { method: "GET", - url: "/public/jobs", + url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/listMapped", + path: { + dag_id: data.dagId, + dag_run_id: data.dagRunId, + task_id: data.taskId, + }, query: { - is_alive: data.isAlive, + logical_date_gte: data.logicalDateGte, + logical_date_lte: data.logicalDateLte, start_date_gte: data.startDateGte, start_date_lte: data.startDateLte, end_date_gte: data.endDateGte, end_date_lte: data.endDateLte, + updated_at_gte: data.updatedAtGte, + updated_at_lte: data.updatedAtLte, + duration_gte: data.durationGte, + duration_lte: data.durationLte, + state: data.state, + pool: data.pool, + queue: data.queue, + executor: data.executor, limit: data.limit, offset: data.offset, order_by: data.orderBy, - job_state: data.jobState, - job_type: data.jobType, - hostname: data.hostname, - executor_class: data.executorClass, }, errors: { - 400: "Bad Request", 401: "Unauthorized", 403: "Forbidden", + 404: "Not Found", 422: "Validation Error", }, }); } -} -export class PluginService { /** - * Get Plugins + * Get Task Instance Dependencies + * Get dependencies blocking task from getting scheduled. * @param data The data for the request. - * @param data.limit - * @param data.offset - * @returns PluginCollectionResponse Successful Response + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @param data.mapIndex + * @returns TaskDependencyCollectionResponse Successful Response * @throws ApiError */ - public static getPlugins( - data: GetPluginsData = {}, - ): CancelablePromise { + public static getTaskInstanceDependencies( + data: GetTaskInstanceDependenciesData, + ): CancelablePromise { return __request(OpenAPI, { method: "GET", - url: "/public/plugins", - query: { - limit: data.limit, - offset: data.offset, + url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/{map_index}/dependencies", + path: { + dag_id: data.dagId, + dag_run_id: data.dagRunId, + task_id: data.taskId, + map_index: data.mapIndex, }, errors: { 401: "Unauthorized", 403: "Forbidden", + 404: "Not Found", 422: "Validation Error", }, }); } -} -export class PoolService { /** - * Delete Pool - * Delete a pool entry. + * Get Task Instance Dependencies + * Get dependencies blocking task from getting scheduled. * @param data The data for the request. - * @param data.poolName - * @returns void Successful Response + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @param data.mapIndex + * @returns TaskDependencyCollectionResponse Successful Response * @throws ApiError */ - public static deletePool( - data: DeletePoolData, - ): CancelablePromise { + public static getTaskInstanceDependencies1( + data: GetTaskInstanceDependencies1Data, + ): CancelablePromise { return __request(OpenAPI, { - method: "DELETE", - url: "/public/pools/{pool_name}", + method: "GET", + url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/dependencies", path: { - pool_name: data.poolName, + dag_id: data.dagId, + dag_run_id: data.dagRunId, + task_id: data.taskId, + }, + query: { + map_index: data.mapIndex, }, errors: { - 400: "Bad Request", 401: "Unauthorized", 403: "Forbidden", 404: "Not Found", @@ -1759,19 +1823,27 @@ export class PoolService { } /** - * Get Pool - * Get a pool. + * Get Mapped Task Instance + * Get task instance. * @param data The data for the request. - * @param data.poolName - * @returns PoolResponse Successful Response + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @param data.mapIndex + * @returns TaskInstanceResponse Successful Response * @throws ApiError */ - public static getPool(data: GetPoolData): CancelablePromise { + public static getMappedTaskInstance( + data: GetMappedTaskInstanceData, + ): CancelablePromise { return __request(OpenAPI, { method: "GET", - url: "/public/pools/{pool_name}", + url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/{map_index}", path: { - pool_name: data.poolName, + dag_id: data.dagId, + dag_run_id: data.dagRunId, + task_id: data.taskId, + map_index: data.mapIndex, }, errors: { 401: "Unauthorized", @@ -1783,187 +1855,14 @@ export class PoolService { } /** - * Patch Pool - * Update a Pool. - * @param data The data for the request. - * @param data.poolName - * @param data.requestBody - * @param data.updateMask - * @returns PoolResponse Successful Response - * @throws ApiError - */ - public static patchPool( - data: PatchPoolData, - ): CancelablePromise { - return __request(OpenAPI, { - method: "PATCH", - url: "/public/pools/{pool_name}", - path: { - pool_name: data.poolName, - }, - query: { - update_mask: data.updateMask, - }, - body: data.requestBody, - mediaType: "application/json", - errors: { - 400: "Bad Request", - 401: "Unauthorized", - 403: "Forbidden", - 404: "Not Found", - 422: "Validation Error", - }, - }); - } - - /** - * Get Pools - * Get all pools entries. - * @param data The data for the request. - * @param data.limit - * @param data.offset - * @param data.orderBy - * @returns PoolCollectionResponse Successful Response - * @throws ApiError - */ - public static getPools( - data: GetPoolsData = {}, - ): CancelablePromise { - return __request(OpenAPI, { - method: "GET", - url: "/public/pools", - query: { - limit: data.limit, - offset: data.offset, - order_by: data.orderBy, - }, - errors: { - 401: "Unauthorized", - 403: "Forbidden", - 404: "Not Found", - 422: "Validation Error", - }, - }); - } - - /** - * Post Pool - * Create a Pool. - * @param data The data for the request. - * @param data.requestBody - * @returns PoolResponse Successful Response - * @throws ApiError - */ - public static postPool( - data: PostPoolData, - ): CancelablePromise { - return __request(OpenAPI, { - method: "POST", - url: "/public/pools", - body: data.requestBody, - mediaType: "application/json", - errors: { - 401: "Unauthorized", - 403: "Forbidden", - 409: "Conflict", - 422: "Validation Error", - }, - }); - } - - /** - * Post Pools - * Create multiple pools. - * @param data The data for the request. - * @param data.requestBody - * @returns PoolCollectionResponse Successful Response - * @throws ApiError - */ - public static postPools( - data: PostPoolsData, - ): CancelablePromise { - return __request(OpenAPI, { - method: "POST", - url: "/public/pools/bulk", - body: data.requestBody, - mediaType: "application/json", - errors: { - 401: "Unauthorized", - 403: "Forbidden", - 409: "Conflict", - 422: "Validation Error", - }, - }); - } -} - -export class ProviderService { - /** - * Get Providers - * Get providers. - * @param data The data for the request. - * @param data.limit - * @param data.offset - * @returns ProviderCollectionResponse Successful Response - * @throws ApiError - */ - public static getProviders( - data: GetProvidersData = {}, - ): CancelablePromise { - return __request(OpenAPI, { - method: "GET", - url: "/public/providers", - query: { - limit: data.limit, - offset: data.offset, - }, - errors: { - 401: "Unauthorized", - 403: "Forbidden", - 422: "Validation Error", - }, - }); - } -} - -export class TaskInstanceService { - /** - * Get Task Instance - * Get task instance. - * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId - * @param data.taskId - * @returns TaskInstanceResponse Successful Response - * @throws ApiError - */ - public static getTaskInstance( - data: GetTaskInstanceData, - ): CancelablePromise { - return __request(OpenAPI, { - method: "GET", - url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}", - path: { - dag_id: data.dagId, - dag_run_id: data.dagRunId, - task_id: data.taskId, - }, - errors: { - 401: "Unauthorized", - 403: "Forbidden", - 404: "Not Found", - 422: "Validation Error", - }, - }); - } - - /** - * Get Mapped Task Instances - * Get list of mapped task instances. + * Get Task Instances + * Get list of task instances. + * + * This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve Task Instances for all DAGs + * and DAG runs. * @param data The data for the request. * @param data.dagId * @param data.dagRunId - * @param data.taskId * @param data.logicalDateGte * @param data.logicalDateLte * @param data.startDateGte @@ -1984,16 +1883,15 @@ export class TaskInstanceService { * @returns TaskInstanceCollectionResponse Successful Response * @throws ApiError */ - public static getMappedTaskInstances( - data: GetMappedTaskInstancesData, - ): CancelablePromise { + public static getTaskInstances( + data: GetTaskInstancesData, + ): CancelablePromise { return __request(OpenAPI, { method: "GET", - url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/listMapped", + url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances", path: { dag_id: data.dagId, dag_run_id: data.dagRunId, - task_id: data.taskId, }, query: { logical_date_gte: data.logicalDateGte, @@ -2024,28 +1922,27 @@ export class TaskInstanceService { } /** - * Get Task Instance Dependencies - * Get dependencies blocking task from getting scheduled. + * Get Task Instances Batch + * Get list of task instances. * @param data The data for the request. * @param data.dagId * @param data.dagRunId - * @param data.taskId - * @param data.mapIndex - * @returns TaskDependencyCollectionResponse Successful Response + * @param data.requestBody + * @returns TaskInstanceCollectionResponse Successful Response * @throws ApiError */ - public static getTaskInstanceDependencies( - data: GetTaskInstanceDependenciesData, - ): CancelablePromise { + public static getTaskInstancesBatch( + data: GetTaskInstancesBatchData, + ): CancelablePromise { return __request(OpenAPI, { - method: "GET", - url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/{map_index}/dependencies", + method: "POST", + url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/list", path: { dag_id: data.dagId, dag_run_id: data.dagRunId, - task_id: data.taskId, - map_index: data.mapIndex, }, + body: data.requestBody, + mediaType: "application/json", errors: { 401: "Unauthorized", 403: "Forbidden", @@ -2056,26 +1953,28 @@ export class TaskInstanceService { } /** - * Get Task Instance Dependencies - * Get dependencies blocking task from getting scheduled. + * Get Task Instance Try Details + * Get task instance details by try number. * @param data The data for the request. * @param data.dagId * @param data.dagRunId * @param data.taskId + * @param data.taskTryNumber * @param data.mapIndex - * @returns TaskDependencyCollectionResponse Successful Response + * @returns TaskInstanceHistoryResponse Successful Response * @throws ApiError */ - public static getTaskInstanceDependencies1( - data: GetTaskInstanceDependencies1Data, - ): CancelablePromise { + public static getTaskInstanceTryDetails( + data: GetTaskInstanceTryDetailsData, + ): CancelablePromise { return __request(OpenAPI, { method: "GET", - url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/dependencies", + url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/tries/{task_try_number}", path: { dag_id: data.dagId, dag_run_id: data.dagRunId, task_id: data.taskId, + task_try_number: data.taskTryNumber, }, query: { map_index: data.mapIndex, @@ -2090,26 +1989,27 @@ export class TaskInstanceService { } /** - * Get Mapped Task Instance - * Get task instance. + * Get Mapped Task Instance Try Details * @param data The data for the request. * @param data.dagId * @param data.dagRunId * @param data.taskId + * @param data.taskTryNumber * @param data.mapIndex - * @returns TaskInstanceResponse Successful Response + * @returns TaskInstanceHistoryResponse Successful Response * @throws ApiError */ - public static getMappedTaskInstance( - data: GetMappedTaskInstanceData, - ): CancelablePromise { + public static getMappedTaskInstanceTryDetails( + data: GetMappedTaskInstanceTryDetailsData, + ): CancelablePromise { return __request(OpenAPI, { method: "GET", - url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/{map_index}", + url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/{map_index}/tries/{task_try_number}", path: { dag_id: data.dagId, dag_run_id: data.dagRunId, task_id: data.taskId, + task_try_number: data.taskTryNumber, map_index: data.mapIndex, }, errors: { @@ -2122,95 +2022,232 @@ export class TaskInstanceService { } /** - * Get Task Instances - * Get list of task instances. - * - * This endpoint allows specifying `~` as the dag_id, dag_run_id to retrieve Task Instances for all DAGs - * and DAG runs. + * Post Clear Task Instances + * Clear task instances. * @param data The data for the request. * @param data.dagId - * @param data.dagRunId - * @param data.logicalDateGte - * @param data.logicalDateLte - * @param data.startDateGte - * @param data.startDateLte - * @param data.endDateGte - * @param data.endDateLte - * @param data.updatedAtGte - * @param data.updatedAtLte - * @param data.durationGte - * @param data.durationLte - * @param data.state - * @param data.pool - * @param data.queue - * @param data.executor - * @param data.limit - * @param data.offset - * @param data.orderBy - * @returns TaskInstanceCollectionResponse Successful Response + * @param data.requestBody + * @returns TaskInstanceReferenceCollectionResponse Successful Response * @throws ApiError */ - public static getTaskInstances( - data: GetTaskInstancesData, - ): CancelablePromise { + public static postClearTaskInstances( + data: PostClearTaskInstancesData, + ): CancelablePromise { + return __request(OpenAPI, { + method: "POST", + url: "/public/dags/{dag_id}/clearTaskInstances", + path: { + dag_id: data.dagId, + }, + body: data.requestBody, + mediaType: "application/json", + errors: { + 401: "Unauthorized", + 403: "Forbidden", + 404: "Not Found", + 422: "Validation Error", + }, + }); + } + + /** + * Get Log + * Get logs for a specific task instance. + * @param data The data for the request. + * @param data.dagId + * @param data.dagRunId + * @param data.taskId + * @param data.tryNumber + * @param data.fullContent + * @param data.mapIndex + * @param data.token + * @param data.accept + * @returns TaskInstancesLogResponse Successful Response + * @throws ApiError + */ + public static getLog(data: GetLogData): CancelablePromise { return __request(OpenAPI, { method: "GET", - url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances", + url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/logs/{try_number}", path: { dag_id: data.dagId, dag_run_id: data.dagRunId, + task_id: data.taskId, + try_number: data.tryNumber, + }, + headers: { + accept: data.accept, }, query: { - logical_date_gte: data.logicalDateGte, - logical_date_lte: data.logicalDateLte, + full_content: data.fullContent, + map_index: data.mapIndex, + token: data.token, + }, + errors: { + 401: "Unauthorized", + 403: "Forbidden", + 404: "Not Found", + 422: "Validation Error", + }, + }); + } +} + +export class ImportErrorService { + /** + * Get Import Error + * Get an import error. + * @param data The data for the request. + * @param data.importErrorId + * @returns ImportErrorResponse Successful Response + * @throws ApiError + */ + public static getImportError( + data: GetImportErrorData, + ): CancelablePromise { + return __request(OpenAPI, { + method: "GET", + url: "/public/importErrors/{import_error_id}", + path: { + import_error_id: data.importErrorId, + }, + errors: { + 401: "Unauthorized", + 403: "Forbidden", + 404: "Not Found", + 422: "Validation Error", + }, + }); + } + + /** + * Get Import Errors + * Get all import errors. + * @param data The data for the request. + * @param data.limit + * @param data.offset + * @param data.orderBy + * @returns ImportErrorCollectionResponse Successful Response + * @throws ApiError + */ + public static getImportErrors( + data: GetImportErrorsData = {}, + ): CancelablePromise { + return __request(OpenAPI, { + method: "GET", + url: "/public/importErrors", + query: { + limit: data.limit, + offset: data.offset, + order_by: data.orderBy, + }, + errors: { + 401: "Unauthorized", + 403: "Forbidden", + 422: "Validation Error", + }, + }); + } +} + +export class JobService { + /** + * Get Jobs + * Get all jobs. + * @param data The data for the request. + * @param data.isAlive + * @param data.startDateGte + * @param data.startDateLte + * @param data.endDateGte + * @param data.endDateLte + * @param data.limit + * @param data.offset + * @param data.orderBy + * @param data.jobState + * @param data.jobType + * @param data.hostname + * @param data.executorClass + * @returns JobCollectionResponse Successful Response + * @throws ApiError + */ + public static getJobs( + data: GetJobsData = {}, + ): CancelablePromise { + return __request(OpenAPI, { + method: "GET", + url: "/public/jobs", + query: { + is_alive: data.isAlive, start_date_gte: data.startDateGte, start_date_lte: data.startDateLte, end_date_gte: data.endDateGte, end_date_lte: data.endDateLte, - updated_at_gte: data.updatedAtGte, - updated_at_lte: data.updatedAtLte, - duration_gte: data.durationGte, - duration_lte: data.durationLte, - state: data.state, - pool: data.pool, - queue: data.queue, - executor: data.executor, limit: data.limit, offset: data.offset, order_by: data.orderBy, + job_state: data.jobState, + job_type: data.jobType, + hostname: data.hostname, + executor_class: data.executorClass, }, errors: { + 400: "Bad Request", 401: "Unauthorized", 403: "Forbidden", - 404: "Not Found", 422: "Validation Error", }, }); } +} +export class PluginService { /** - * Get Task Instances Batch - * Get list of task instances. + * Get Plugins * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId - * @param data.requestBody - * @returns TaskInstanceCollectionResponse Successful Response + * @param data.limit + * @param data.offset + * @returns PluginCollectionResponse Successful Response * @throws ApiError */ - public static getTaskInstancesBatch( - data: GetTaskInstancesBatchData, - ): CancelablePromise { + public static getPlugins( + data: GetPluginsData = {}, + ): CancelablePromise { return __request(OpenAPI, { - method: "POST", - url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/list", + method: "GET", + url: "/public/plugins", + query: { + limit: data.limit, + offset: data.offset, + }, + errors: { + 401: "Unauthorized", + 403: "Forbidden", + 422: "Validation Error", + }, + }); + } +} + +export class PoolService { + /** + * Delete Pool + * Delete a pool entry. + * @param data The data for the request. + * @param data.poolName + * @returns void Successful Response + * @throws ApiError + */ + public static deletePool( + data: DeletePoolData, + ): CancelablePromise { + return __request(OpenAPI, { + method: "DELETE", + url: "/public/pools/{pool_name}", path: { - dag_id: data.dagId, - dag_run_id: data.dagRunId, + pool_name: data.poolName, }, - body: data.requestBody, - mediaType: "application/json", errors: { + 400: "Bad Request", 401: "Unauthorized", 403: "Forbidden", 404: "Not Found", @@ -2220,33 +2257,55 @@ export class TaskInstanceService { } /** - * Get Task Instance Try Details - * Get task instance details by try number. + * Get Pool + * Get a pool. * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId - * @param data.taskId - * @param data.taskTryNumber - * @param data.mapIndex - * @returns TaskInstanceHistoryResponse Successful Response + * @param data.poolName + * @returns PoolResponse Successful Response * @throws ApiError */ - public static getTaskInstanceTryDetails( - data: GetTaskInstanceTryDetailsData, - ): CancelablePromise { + public static getPool(data: GetPoolData): CancelablePromise { return __request(OpenAPI, { method: "GET", - url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/tries/{task_try_number}", + url: "/public/pools/{pool_name}", path: { - dag_id: data.dagId, - dag_run_id: data.dagRunId, - task_id: data.taskId, - task_try_number: data.taskTryNumber, + pool_name: data.poolName, + }, + errors: { + 401: "Unauthorized", + 403: "Forbidden", + 404: "Not Found", + 422: "Validation Error", + }, + }); + } + + /** + * Patch Pool + * Update a Pool. + * @param data The data for the request. + * @param data.poolName + * @param data.requestBody + * @param data.updateMask + * @returns PoolResponse Successful Response + * @throws ApiError + */ + public static patchPool( + data: PatchPoolData, + ): CancelablePromise { + return __request(OpenAPI, { + method: "PATCH", + url: "/public/pools/{pool_name}", + path: { + pool_name: data.poolName, }, query: { - map_index: data.mapIndex, + update_mask: data.updateMask, }, + body: data.requestBody, + mediaType: "application/json", errors: { + 400: "Bad Request", 401: "Unauthorized", 403: "Forbidden", 404: "Not Found", @@ -2256,28 +2315,25 @@ export class TaskInstanceService { } /** - * Get Mapped Task Instance Try Details + * Get Pools + * Get all pools entries. * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId - * @param data.taskId - * @param data.taskTryNumber - * @param data.mapIndex - * @returns TaskInstanceHistoryResponse Successful Response + * @param data.limit + * @param data.offset + * @param data.orderBy + * @returns PoolCollectionResponse Successful Response * @throws ApiError */ - public static getMappedTaskInstanceTryDetails( - data: GetMappedTaskInstanceTryDetailsData, - ): CancelablePromise { + public static getPools( + data: GetPoolsData = {}, + ): CancelablePromise { return __request(OpenAPI, { method: "GET", - url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/{map_index}/tries/{task_try_number}", - path: { - dag_id: data.dagId, - dag_run_id: data.dagRunId, - task_id: data.taskId, - task_try_number: data.taskTryNumber, - map_index: data.mapIndex, + url: "/public/pools", + query: { + limit: data.limit, + offset: data.offset, + order_by: data.orderBy, }, errors: { 401: "Unauthorized", @@ -2289,71 +2345,79 @@ export class TaskInstanceService { } /** - * Post Clear Task Instances - * Clear task instances. + * Post Pool + * Create a Pool. * @param data The data for the request. - * @param data.dagId * @param data.requestBody - * @returns TaskInstanceReferenceCollectionResponse Successful Response + * @returns PoolResponse Successful Response * @throws ApiError */ - public static postClearTaskInstances( - data: PostClearTaskInstancesData, - ): CancelablePromise { + public static postPool( + data: PostPoolData, + ): CancelablePromise { return __request(OpenAPI, { method: "POST", - url: "/public/dags/{dag_id}/clearTaskInstances", - path: { - dag_id: data.dagId, + url: "/public/pools", + body: data.requestBody, + mediaType: "application/json", + errors: { + 401: "Unauthorized", + 403: "Forbidden", + 409: "Conflict", + 422: "Validation Error", }, + }); + } + + /** + * Post Pools + * Create multiple pools. + * @param data The data for the request. + * @param data.requestBody + * @returns PoolCollectionResponse Successful Response + * @throws ApiError + */ + public static postPools( + data: PostPoolsData, + ): CancelablePromise { + return __request(OpenAPI, { + method: "POST", + url: "/public/pools/bulk", body: data.requestBody, mediaType: "application/json", errors: { 401: "Unauthorized", 403: "Forbidden", - 404: "Not Found", + 409: "Conflict", 422: "Validation Error", }, }); } +} +export class ProviderService { /** - * Get Log - * Get logs for a specific task instance. + * Get Providers + * Get providers. * @param data The data for the request. - * @param data.dagId - * @param data.dagRunId - * @param data.taskId - * @param data.tryNumber - * @param data.fullContent - * @param data.mapIndex - * @param data.token - * @param data.accept - * @returns TaskInstancesLogResponse Successful Response + * @param data.limit + * @param data.offset + * @returns ProviderCollectionResponse Successful Response * @throws ApiError */ - public static getLog(data: GetLogData): CancelablePromise { + public static getProviders( + data: GetProvidersData = {}, + ): CancelablePromise { return __request(OpenAPI, { method: "GET", - url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/logs/{try_number}", - path: { - dag_id: data.dagId, - dag_run_id: data.dagRunId, - task_id: data.taskId, - try_number: data.tryNumber, - }, - headers: { - accept: data.accept, - }, + url: "/public/providers", query: { - full_content: data.fullContent, - map_index: data.mapIndex, - token: data.token, + limit: data.limit, + offset: data.offset, }, errors: { 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 c2b8d2c048f32..c53709d8b3b76 100644 --- a/airflow/ui/openapi-gen/requests/types.gen.ts +++ b/airflow/ui/openapi-gen/requests/types.gen.ts @@ -626,6 +626,13 @@ export type EventLogResponse = { extra: string | null; }; +/** + * Extra Links Response. + */ +export type ExtraLinksResponse = { + [key: string]: string | null; +}; + /** * Serializer for Plugin FastAPI App responses. */ @@ -1543,90 +1550,13 @@ export type GetEventLogsData = { export type GetEventLogsResponse = EventLogCollectionResponse; -export type GetImportErrorData = { - importErrorId: number; -}; - -export type GetImportErrorResponse = ImportErrorResponse; - -export type GetImportErrorsData = { - limit?: number; - offset?: number; - orderBy?: string; -}; - -export type GetImportErrorsResponse = ImportErrorCollectionResponse; - -export type GetJobsData = { - endDateGte?: string | null; - endDateLte?: string | null; - executorClass?: string | null; - hostname?: string | null; - isAlive?: boolean | null; - jobState?: string | null; - jobType?: string | null; - limit?: number; - offset?: number; - orderBy?: string; - startDateGte?: string | null; - startDateLte?: string | null; -}; - -export type GetJobsResponse = JobCollectionResponse; - -export type GetPluginsData = { - limit?: number; - offset?: number; -}; - -export type GetPluginsResponse = PluginCollectionResponse; - -export type DeletePoolData = { - poolName: string; -}; - -export type DeletePoolResponse = void; - -export type GetPoolData = { - poolName: string; -}; - -export type GetPoolResponse = PoolResponse; - -export type PatchPoolData = { - poolName: string; - requestBody: PoolPatchBody; - updateMask?: Array | null; -}; - -export type PatchPoolResponse = PoolResponse; - -export type GetPoolsData = { - limit?: number; - offset?: number; - orderBy?: string; -}; - -export type GetPoolsResponse = PoolCollectionResponse; - -export type PostPoolData = { - requestBody: PoolPostBody; -}; - -export type PostPoolResponse = PoolResponse; - -export type PostPoolsData = { - requestBody: PoolPostBulkBody; -}; - -export type PostPoolsResponse = PoolCollectionResponse; - -export type GetProvidersData = { - limit?: number; - offset?: number; +export type GetExtraLinksData = { + dagId: string; + dagRunId: string; + taskId: string; }; -export type GetProvidersResponse = ProviderCollectionResponse; +export type GetExtraLinksResponse = ExtraLinksResponse; export type GetTaskInstanceData = { dagId: string; @@ -1764,6 +1694,91 @@ export type GetLogData = { export type GetLogResponse = TaskInstancesLogResponse; +export type GetImportErrorData = { + importErrorId: number; +}; + +export type GetImportErrorResponse = ImportErrorResponse; + +export type GetImportErrorsData = { + limit?: number; + offset?: number; + orderBy?: string; +}; + +export type GetImportErrorsResponse = ImportErrorCollectionResponse; + +export type GetJobsData = { + endDateGte?: string | null; + endDateLte?: string | null; + executorClass?: string | null; + hostname?: string | null; + isAlive?: boolean | null; + jobState?: string | null; + jobType?: string | null; + limit?: number; + offset?: number; + orderBy?: string; + startDateGte?: string | null; + startDateLte?: string | null; +}; + +export type GetJobsResponse = JobCollectionResponse; + +export type GetPluginsData = { + limit?: number; + offset?: number; +}; + +export type GetPluginsResponse = PluginCollectionResponse; + +export type DeletePoolData = { + poolName: string; +}; + +export type DeletePoolResponse = void; + +export type GetPoolData = { + poolName: string; +}; + +export type GetPoolResponse = PoolResponse; + +export type PatchPoolData = { + poolName: string; + requestBody: PoolPatchBody; + updateMask?: Array | null; +}; + +export type PatchPoolResponse = PoolResponse; + +export type GetPoolsData = { + limit?: number; + offset?: number; + orderBy?: string; +}; + +export type GetPoolsResponse = PoolCollectionResponse; + +export type PostPoolData = { + requestBody: PoolPostBody; +}; + +export type PostPoolResponse = PoolResponse; + +export type PostPoolsData = { + requestBody: PoolPostBulkBody; +}; + +export type PostPoolsResponse = PoolCollectionResponse; + +export type GetProvidersData = { + limit?: number; + offset?: number; +}; + +export type GetProvidersResponse = ProviderCollectionResponse; + export type GetTasksData = { dagId: string; orderBy?: string; @@ -3054,14 +3069,14 @@ export type $OpenApiTs = { }; }; }; - "/public/importErrors/{import_error_id}": { + "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/links": { get: { - req: GetImportErrorData; + req: GetExtraLinksData; res: { /** * Successful Response */ - 200: ImportErrorResponse; + 200: ExtraLinksResponse; /** * Unauthorized */ @@ -3081,14 +3096,14 @@ export type $OpenApiTs = { }; }; }; - "/public/importErrors": { + "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}": { get: { - req: GetImportErrorsData; + req: GetTaskInstanceData; res: { /** * Successful Response */ - 200: ImportErrorCollectionResponse; + 200: TaskInstanceResponse; /** * Unauthorized */ @@ -3097,6 +3112,10 @@ export type $OpenApiTs = { * Forbidden */ 403: HTTPExceptionResponse; + /** + * Not Found + */ + 404: HTTPExceptionResponse; /** * Validation Error */ @@ -3104,18 +3123,14 @@ export type $OpenApiTs = { }; }; }; - "/public/jobs": { + "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/listMapped": { get: { - req: GetJobsData; + req: GetMappedTaskInstancesData; res: { /** * Successful Response */ - 200: JobCollectionResponse; - /** - * Bad Request - */ - 400: HTTPExceptionResponse; + 200: TaskInstanceCollectionResponse; /** * Unauthorized */ @@ -3124,6 +3139,10 @@ export type $OpenApiTs = { * Forbidden */ 403: HTTPExceptionResponse; + /** + * Not Found + */ + 404: HTTPExceptionResponse; /** * Validation Error */ @@ -3131,14 +3150,14 @@ export type $OpenApiTs = { }; }; }; - "/public/plugins": { + "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/{map_index}/dependencies": { get: { - req: GetPluginsData; + req: GetTaskInstanceDependenciesData; res: { /** * Successful Response */ - 200: PluginCollectionResponse; + 200: TaskDependencyCollectionResponse; /** * Unauthorized */ @@ -3147,6 +3166,10 @@ export type $OpenApiTs = { * Forbidden */ 403: HTTPExceptionResponse; + /** + * Not Found + */ + 404: HTTPExceptionResponse; /** * Validation Error */ @@ -3154,18 +3177,14 @@ export type $OpenApiTs = { }; }; }; - "/public/pools/{pool_name}": { - delete: { - req: DeletePoolData; + "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/dependencies": { + get: { + req: GetTaskInstanceDependencies1Data; res: { /** * Successful Response */ - 204: void; - /** - * Bad Request - */ - 400: HTTPExceptionResponse; + 200: TaskDependencyCollectionResponse; /** * Unauthorized */ @@ -3184,13 +3203,15 @@ export type $OpenApiTs = { 422: HTTPValidationError; }; }; + }; + "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/{map_index}": { get: { - req: GetPoolData; + req: GetMappedTaskInstanceData; res: { /** * Successful Response */ - 200: PoolResponse; + 200: TaskInstanceResponse; /** * Unauthorized */ @@ -3209,17 +3230,15 @@ export type $OpenApiTs = { 422: HTTPValidationError; }; }; - patch: { - req: PatchPoolData; + }; + "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances": { + get: { + req: GetTaskInstancesData; res: { /** * Successful Response */ - 200: PoolResponse; - /** - * Bad Request - */ - 400: HTTPExceptionResponse; + 200: TaskInstanceCollectionResponse; /** * Unauthorized */ @@ -3239,14 +3258,14 @@ export type $OpenApiTs = { }; }; }; - "/public/pools": { - get: { - req: GetPoolsData; + "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/list": { + post: { + req: GetTaskInstancesBatchData; res: { /** * Successful Response */ - 200: PoolCollectionResponse; + 200: TaskInstanceCollectionResponse; /** * Unauthorized */ @@ -3265,13 +3284,15 @@ export type $OpenApiTs = { 422: HTTPValidationError; }; }; - post: { - req: PostPoolData; + }; + "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/tries/{task_try_number}": { + get: { + req: GetTaskInstanceTryDetailsData; res: { /** * Successful Response */ - 201: PoolResponse; + 200: TaskInstanceHistoryResponse; /** * Unauthorized */ @@ -3281,9 +3302,9 @@ export type $OpenApiTs = { */ 403: HTTPExceptionResponse; /** - * Conflict + * Not Found */ - 409: HTTPExceptionResponse; + 404: HTTPExceptionResponse; /** * Validation Error */ @@ -3291,14 +3312,14 @@ export type $OpenApiTs = { }; }; }; - "/public/pools/bulk": { - post: { - req: PostPoolsData; + "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/{map_index}/tries/{task_try_number}": { + get: { + req: GetMappedTaskInstanceTryDetailsData; res: { /** * Successful Response */ - 201: PoolCollectionResponse; + 200: TaskInstanceHistoryResponse; /** * Unauthorized */ @@ -3308,9 +3329,9 @@ export type $OpenApiTs = { */ 403: HTTPExceptionResponse; /** - * Conflict + * Not Found */ - 409: HTTPExceptionResponse; + 404: HTTPExceptionResponse; /** * Validation Error */ @@ -3318,14 +3339,14 @@ export type $OpenApiTs = { }; }; }; - "/public/providers": { - get: { - req: GetProvidersData; + "/public/dags/{dag_id}/clearTaskInstances": { + post: { + req: PostClearTaskInstancesData; res: { /** * Successful Response */ - 200: ProviderCollectionResponse; + 200: TaskInstanceReferenceCollectionResponse; /** * Unauthorized */ @@ -3334,6 +3355,10 @@ export type $OpenApiTs = { * Forbidden */ 403: HTTPExceptionResponse; + /** + * Not Found + */ + 404: HTTPExceptionResponse; /** * Validation Error */ @@ -3341,14 +3366,14 @@ export type $OpenApiTs = { }; }; }; - "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}": { + "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/logs/{try_number}": { get: { - req: GetTaskInstanceData; + req: GetLogData; res: { /** * Successful Response */ - 200: TaskInstanceResponse; + 200: TaskInstancesLogResponse; /** * Unauthorized */ @@ -3368,14 +3393,14 @@ export type $OpenApiTs = { }; }; }; - "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/listMapped": { + "/public/importErrors/{import_error_id}": { get: { - req: GetMappedTaskInstancesData; + req: GetImportErrorData; res: { /** * Successful Response */ - 200: TaskInstanceCollectionResponse; + 200: ImportErrorResponse; /** * Unauthorized */ @@ -3395,14 +3420,14 @@ export type $OpenApiTs = { }; }; }; - "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/{map_index}/dependencies": { + "/public/importErrors": { get: { - req: GetTaskInstanceDependenciesData; + req: GetImportErrorsData; res: { /** * Successful Response */ - 200: TaskDependencyCollectionResponse; + 200: ImportErrorCollectionResponse; /** * Unauthorized */ @@ -3411,10 +3436,6 @@ export type $OpenApiTs = { * Forbidden */ 403: HTTPExceptionResponse; - /** - * Not Found - */ - 404: HTTPExceptionResponse; /** * Validation Error */ @@ -3422,14 +3443,18 @@ export type $OpenApiTs = { }; }; }; - "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/dependencies": { + "/public/jobs": { get: { - req: GetTaskInstanceDependencies1Data; + req: GetJobsData; res: { /** * Successful Response */ - 200: TaskDependencyCollectionResponse; + 200: JobCollectionResponse; + /** + * Bad Request + */ + 400: HTTPExceptionResponse; /** * Unauthorized */ @@ -3439,9 +3464,28 @@ export type $OpenApiTs = { */ 403: HTTPExceptionResponse; /** - * Not Found + * Validation Error */ - 404: HTTPExceptionResponse; + 422: HTTPValidationError; + }; + }; + }; + "/public/plugins": { + get: { + req: GetPluginsData; + res: { + /** + * Successful Response + */ + 200: PluginCollectionResponse; + /** + * Unauthorized + */ + 401: HTTPExceptionResponse; + /** + * Forbidden + */ + 403: HTTPExceptionResponse; /** * Validation Error */ @@ -3449,14 +3493,18 @@ export type $OpenApiTs = { }; }; }; - "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/{map_index}": { - get: { - req: GetMappedTaskInstanceData; + "/public/pools/{pool_name}": { + delete: { + req: DeletePoolData; res: { /** * Successful Response */ - 200: TaskInstanceResponse; + 204: void; + /** + * Bad Request + */ + 400: HTTPExceptionResponse; /** * Unauthorized */ @@ -3475,15 +3523,13 @@ export type $OpenApiTs = { 422: HTTPValidationError; }; }; - }; - "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances": { get: { - req: GetTaskInstancesData; + req: GetPoolData; res: { /** * Successful Response */ - 200: TaskInstanceCollectionResponse; + 200: PoolResponse; /** * Unauthorized */ @@ -3502,15 +3548,17 @@ export type $OpenApiTs = { 422: HTTPValidationError; }; }; - }; - "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/list": { - post: { - req: GetTaskInstancesBatchData; + patch: { + req: PatchPoolData; res: { /** * Successful Response */ - 200: TaskInstanceCollectionResponse; + 200: PoolResponse; + /** + * Bad Request + */ + 400: HTTPExceptionResponse; /** * Unauthorized */ @@ -3530,14 +3578,14 @@ export type $OpenApiTs = { }; }; }; - "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/tries/{task_try_number}": { + "/public/pools": { get: { - req: GetTaskInstanceTryDetailsData; + req: GetPoolsData; res: { /** * Successful Response */ - 200: TaskInstanceHistoryResponse; + 200: PoolCollectionResponse; /** * Unauthorized */ @@ -3556,15 +3604,13 @@ export type $OpenApiTs = { 422: HTTPValidationError; }; }; - }; - "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/{map_index}/tries/{task_try_number}": { - get: { - req: GetMappedTaskInstanceTryDetailsData; + post: { + req: PostPoolData; res: { /** * Successful Response */ - 200: TaskInstanceHistoryResponse; + 201: PoolResponse; /** * Unauthorized */ @@ -3574,9 +3620,9 @@ export type $OpenApiTs = { */ 403: HTTPExceptionResponse; /** - * Not Found + * Conflict */ - 404: HTTPExceptionResponse; + 409: HTTPExceptionResponse; /** * Validation Error */ @@ -3584,14 +3630,14 @@ export type $OpenApiTs = { }; }; }; - "/public/dags/{dag_id}/clearTaskInstances": { + "/public/pools/bulk": { post: { - req: PostClearTaskInstancesData; + req: PostPoolsData; res: { /** * Successful Response */ - 200: TaskInstanceReferenceCollectionResponse; + 201: PoolCollectionResponse; /** * Unauthorized */ @@ -3601,9 +3647,9 @@ export type $OpenApiTs = { */ 403: HTTPExceptionResponse; /** - * Not Found + * Conflict */ - 404: HTTPExceptionResponse; + 409: HTTPExceptionResponse; /** * Validation Error */ @@ -3611,14 +3657,14 @@ export type $OpenApiTs = { }; }; }; - "/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/logs/{try_number}": { + "/public/providers": { get: { - req: GetLogData; + req: GetProvidersData; res: { /** * Successful Response */ - 200: TaskInstancesLogResponse; + 200: ProviderCollectionResponse; /** * Unauthorized */ @@ -3627,10 +3673,6 @@ export type $OpenApiTs = { * Forbidden */ 403: HTTPExceptionResponse; - /** - * Not Found - */ - 404: HTTPExceptionResponse; /** * Validation Error */ diff --git a/tests/api_fastapi/core_api/routes/public/test_extra_links.py b/tests/api_fastapi/core_api/routes/public/test_extra_links.py new file mode 100644 index 0000000000000..6b1d6b4077d0a --- /dev/null +++ b/tests/api_fastapi/core_api/routes/public/test_extra_links.py @@ -0,0 +1,221 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +import os +from urllib.parse import quote_plus + +import pytest + +from airflow.models.dag import DAG +from airflow.models.dagbag import DagBag +from airflow.models.xcom import XCom +from airflow.plugins_manager import AirflowPlugin +from airflow.utils import timezone +from airflow.utils.session import provide_session +from airflow.utils.state import DagRunState +from airflow.utils.types import DagRunType + +from tests_common.test_utils.compat import AIRFLOW_V_3_0_PLUS, BaseOperatorLink +from tests_common.test_utils.db import clear_db_dags, clear_db_runs, clear_db_xcom +from tests_common.test_utils.mock_operators import CustomOperator +from tests_common.test_utils.mock_plugins import mock_plugin_manager + +if AIRFLOW_V_3_0_PLUS: + from airflow.utils.types import DagRunTriggeredByType + +pytestmark = [pytest.mark.db_test, pytest.mark.skip_if_database_isolation_mode] + + +class TestExtraLinks: + dag_id = "TEST_DAG_ID" + dag_run_id = "TEST_DAG_RUN_ID" + task_single_link = "TEST_SINGLE_LINK" + task_multiple_links = "TEST_MULTIPLE_LINKS" + default_time = timezone.datetime(2020, 1, 1) + plugin_name = "test_plugin" + + @staticmethod + def _clear_db(): + clear_db_dags() + clear_db_runs() + clear_db_xcom() + + @provide_session + @pytest.fixture(autouse=True) + def setup(self, test_client, session=None) -> None: + """ + Setup extra links for testing. + :return: Dictionary with event extra link names with their corresponding link as the links. + """ + self._clear_db() + + self.dag = self._create_dag() + + dag_bag = DagBag(os.devnull, include_examples=False) + dag_bag.dags = {self.dag.dag_id: self.dag} + test_client.app.state.dag_bag = dag_bag + dag_bag.sync_to_db() + + triggered_by_kwargs = {"triggered_by": DagRunTriggeredByType.TEST} + + self.dag.create_dagrun( + run_id=self.dag_run_id, + logical_date=self.default_time, + run_type=DagRunType.MANUAL, + state=DagRunState.SUCCESS, + data_interval=(timezone.datetime(2020, 1, 1), timezone.datetime(2020, 1, 2)), + **triggered_by_kwargs, + ) + + def teardown_method(self) -> None: + self._clear_db() + + def _create_dag(self): + with DAG(dag_id=self.dag_id, schedule=None, default_args={"start_date": self.default_time}) as dag: + CustomOperator(task_id=self.task_single_link, bash_command="TEST_LINK_VALUE") + CustomOperator( + task_id=self.task_multiple_links, bash_command=["TEST_LINK_VALUE_1", "TEST_LINK_VALUE_2"] + ) + return dag + + +class TestGetExtraLinks(TestExtraLinks): + @pytest.mark.parametrize( + "url, expected_status_code, expected_response", + [ + pytest.param( + "/public/dags/INVALID/dagRuns/TEST_DAG_RUN_ID/taskInstances/TEST_SINGLE_LINK/links", + 404, + {"detail": "DAG with ID = INVALID not found"}, + id="missing_dag", + ), + pytest.param( + "/public/dags/TEST_DAG_ID/dagRuns/INVALID/taskInstances/TEST_SINGLE_LINK/links", + 404, + {"detail": "DAG Run with ID = INVALID not found"}, + id="missing_dag_run", + ), + pytest.param( + "/public/dags/TEST_DAG_ID/dagRuns/TEST_DAG_RUN_ID/taskInstances/INVALID/links", + 404, + {"detail": "Task with ID = INVALID not found"}, + id="missing_task", + ), + ], + ) + def test_should_respond_404(self, test_client, url, expected_status_code, expected_response): + response = test_client.get(url) + + assert response.status_code == expected_status_code + assert response.json() == expected_response + + @mock_plugin_manager(plugins=[]) + def test_should_respond_200(self, test_client): + XCom.set( + key="search_query", + value="TEST_LINK_VALUE", + task_id=self.task_single_link, + dag_id=self.dag_id, + run_id=self.dag_run_id, + ) + response = test_client.get( + f"/public/dags/{self.dag_id}/dagRuns/{self.dag_run_id}/taskInstances/{self.task_single_link}/links", + ) + + assert response.status_code == 200 + assert response.json() == { + "Google Custom": "http://google.com/custom_base_link?search=TEST_LINK_VALUE" + } + + @mock_plugin_manager(plugins=[]) + def test_should_respond_200_missing_xcom(self, test_client): + response = test_client.get( + f"/public/dags/{self.dag_id}/dagRuns/{self.dag_run_id}/taskInstances/{self.task_single_link}/links", + ) + + assert response.status_code == 200 + assert response.json() == {"Google Custom": None} + + @mock_plugin_manager(plugins=[]) + def test_should_respond_200_multiple_links(self, test_client): + XCom.set( + key="search_query", + value=["TEST_LINK_VALUE_1", "TEST_LINK_VALUE_2"], + task_id=self.task_multiple_links, + dag_id=self.dag.dag_id, + run_id=self.dag_run_id, + ) + response = test_client.get( + f"/public/dags/{self.dag_id}/dagRuns/{self.dag_run_id}/taskInstances/{self.task_multiple_links}/links", + ) + + assert response.status_code == 200 + assert response.json() == { + "BigQuery Console #1": "https://console.cloud.google.com/bigquery?j=TEST_LINK_VALUE_1", + "BigQuery Console #2": "https://console.cloud.google.com/bigquery?j=TEST_LINK_VALUE_2", + } + + @mock_plugin_manager(plugins=[]) + def test_should_respond_200_multiple_links_missing_xcom(self, test_client): + response = test_client.get( + f"/public/dags/{self.dag_id}/dagRuns/{self.dag_run_id}/taskInstances/{self.task_multiple_links}/links", + ) + + assert response.status_code == 200 + assert response.json() == {"BigQuery Console #1": None, "BigQuery Console #2": None} + + def test_should_respond_200_support_plugins(self, test_client): + class GoogleLink(BaseOperatorLink): + name = "Google" + + def get_link(self, operator, dttm): + return "https://www.google.com" + + class S3LogLink(BaseOperatorLink): + name = "S3" + operators = [CustomOperator] + + def get_link(self, operator, dttm): + return ( + f"https://s3.amazonaws.com/airflow-logs/{operator.dag_id}/" + f"{operator.task_id}/{quote_plus(dttm.isoformat())}" + ) + + class AirflowTestPlugin(AirflowPlugin): + name = "test_plugin" + global_operator_extra_links = [ + GoogleLink(), + ] + operator_extra_links = [ + S3LogLink(), + ] + + with mock_plugin_manager(plugins=[AirflowTestPlugin]): + response = test_client.get( + f"/public/dags/{self.dag_id}/dagRuns/{self.dag_run_id}/taskInstances/{self.task_single_link}/links", + ) + + assert response, response.status_code == 200 + assert response.json() == { + "Google Custom": None, + "Google": "https://www.google.com", + "S3": ( + "https://s3.amazonaws.com/airflow-logs/" + "TEST_DAG_ID/TEST_SINGLE_LINK/2020-01-01T00%3A00%3A00%2B00%3A00" + ), + }