Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions airflow/api_connexion/endpoints/dag_run_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def get_dag_run(
raise BadRequest("DAGRunSchema error", detail=str(e))


@mark_fastapi_migration_done
@security.requires_access_dag("GET", DagAccessEntity.RUN)
@security.requires_access_asset("GET")
@provide_session
Expand Down
55 changes: 55 additions & 0 deletions airflow/api_fastapi/core_api/openapi/v1-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1387,6 +1387,61 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/public/dags/{dag_id}/dagRuns/{dag_run_id}/upstreamDatasetEvents:
get:
tags:
- DagRun
summary: Get Upstream Asset Events
operationId: get_upstream_asset_events
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
responses:
'200':
description: Successful Response
content:
application/json:
schema: {}
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Bad Request
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Forbidden
'404':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Not Found
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/public/dagSources/{file_token}:
get:
tags:
Expand Down
17 changes: 17 additions & 0 deletions airflow/api_fastapi/core_api/routes/public/dag_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,20 @@ def patch_dag_run(
dag_run = session.get(DagRun, dag_run.id)

return DAGRunResponse.model_validate(dag_run, from_attributes=True)


@dag_run_router.get(
"/{dag_run_id}/upstreamDatasetEvents",
responses=create_openapi_http_exception_doc(
[
status.HTTP_400_BAD_REQUEST,
status.HTTP_401_UNAUTHORIZED,
status.HTTP_403_FORBIDDEN,
status.HTTP_404_NOT_FOUND,
]
),
)
def get_upstream_asset_events(
dag_id: str, dag_run_id: str, session: Annotated[Session, Depends(get_session)]
):
pass
22 changes: 22 additions & 0 deletions airflow/ui/openapi-gen/queries/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,28 @@ export const UseDagRunServiceGetDagRunKeyFn = (
},
queryKey?: Array<unknown>,
) => [useDagRunServiceGetDagRunKey, ...(queryKey ?? [{ dagId, dagRunId }])];
export type DagRunServiceGetUpstreamAssetEventsDefaultResponse = Awaited<
ReturnType<typeof DagRunService.getUpstreamAssetEvents>
>;
export type DagRunServiceGetUpstreamAssetEventsQueryResult<
TData = DagRunServiceGetUpstreamAssetEventsDefaultResponse,
TError = unknown,
> = UseQueryResult<TData, TError>;
export const useDagRunServiceGetUpstreamAssetEventsKey =
"DagRunServiceGetUpstreamAssetEvents";
export const UseDagRunServiceGetUpstreamAssetEventsKeyFn = (
{
dagId,
dagRunId,
}: {
dagId: string;
dagRunId: string;
},
queryKey?: Array<unknown>,
) => [
useDagRunServiceGetUpstreamAssetEventsKey,
...(queryKey ?? [{ dagId, dagRunId }]),
];
export type DagSourceServiceGetDagSourceDefaultResponse = Awaited<
ReturnType<typeof DagSourceService.getDagSource>
>;
Expand Down
25 changes: 25 additions & 0 deletions airflow/ui/openapi-gen/queries/prefetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,31 @@ export const prefetchUseDagRunServiceGetDagRun = (
queryKey: Common.UseDagRunServiceGetDagRunKeyFn({ dagId, dagRunId }),
queryFn: () => DagRunService.getDagRun({ dagId, dagRunId }),
});
/**
* Get Upstream Asset Events
* @param data The data for the request.
* @param data.dagId
* @param data.dagRunId
* @returns unknown Successful Response
* @throws ApiError
*/
export const prefetchUseDagRunServiceGetUpstreamAssetEvents = (
queryClient: QueryClient,
{
dagId,
dagRunId,
}: {
dagId: string;
dagRunId: string;
},
) =>
queryClient.prefetchQuery({
queryKey: Common.UseDagRunServiceGetUpstreamAssetEventsKeyFn({
dagId,
dagRunId,
}),
queryFn: () => DagRunService.getUpstreamAssetEvents({ dagId, dagRunId }),
});
/**
* Get Dag Source
* Get source code using file token.
Expand Down
32 changes: 32 additions & 0 deletions airflow/ui/openapi-gen/queries/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,38 @@ export const useDagRunServiceGetDagRun = <
queryFn: () => DagRunService.getDagRun({ dagId, dagRunId }) as TData,
...options,
});
/**
* Get Upstream Asset Events
* @param data The data for the request.
* @param data.dagId
* @param data.dagRunId
* @returns unknown Successful Response
* @throws ApiError
*/
export const useDagRunServiceGetUpstreamAssetEvents = <
TData = Common.DagRunServiceGetUpstreamAssetEventsDefaultResponse,
TError = unknown,
TQueryKey extends Array<unknown> = unknown[],
>(
{
dagId,
dagRunId,
}: {
dagId: string;
dagRunId: string;
},
queryKey?: TQueryKey,
options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">,
) =>
useQuery<TData, TError>({
queryKey: Common.UseDagRunServiceGetUpstreamAssetEventsKeyFn(
{ dagId, dagRunId },
queryKey,
),
queryFn: () =>
DagRunService.getUpstreamAssetEvents({ dagId, dagRunId }) as TData,
...options,
});
/**
* Get Dag Source
* Get source code using file token.
Expand Down
32 changes: 32 additions & 0 deletions airflow/ui/openapi-gen/queries/suspense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,38 @@ export const useDagRunServiceGetDagRunSuspense = <
queryFn: () => DagRunService.getDagRun({ dagId, dagRunId }) as TData,
...options,
});
/**
* Get Upstream Asset Events
* @param data The data for the request.
* @param data.dagId
* @param data.dagRunId
* @returns unknown Successful Response
* @throws ApiError
*/
export const useDagRunServiceGetUpstreamAssetEventsSuspense = <
TData = Common.DagRunServiceGetUpstreamAssetEventsDefaultResponse,
TError = unknown,
TQueryKey extends Array<unknown> = unknown[],
>(
{
dagId,
dagRunId,
}: {
dagId: string;
dagRunId: string;
},
queryKey?: TQueryKey,
options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">,
) =>
useSuspenseQuery<TData, TError>({
queryKey: Common.UseDagRunServiceGetUpstreamAssetEventsKeyFn(
{ dagId, dagRunId },
queryKey,
),
queryFn: () =>
DagRunService.getUpstreamAssetEvents({ dagId, dagRunId }) as TData,
...options,
});
/**
* Get Dag Source
* Get source code using file token.
Expand Down
30 changes: 30 additions & 0 deletions airflow/ui/openapi-gen/requests/services.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ import type {
DeleteDagRunResponse,
PatchDagRunData,
PatchDagRunResponse,
GetUpstreamAssetEventsData,
GetUpstreamAssetEventsResponse,
GetDagSourceData,
GetDagSourceResponse,
GetEventLogData,
Expand Down Expand Up @@ -828,6 +830,34 @@ export class DagRunService {
},
});
}

/**
* Get Upstream Asset Events
* @param data The data for the request.
* @param data.dagId
* @param data.dagRunId
* @returns unknown Successful Response
* @throws ApiError
*/
public static getUpstreamAssetEvents(
data: GetUpstreamAssetEventsData,
): CancelablePromise<GetUpstreamAssetEventsResponse> {
return __request(OpenAPI, {
method: "GET",
url: "/public/dags/{dag_id}/dagRuns/{dag_run_id}/upstreamDatasetEvents",
path: {
dag_id: data.dagId,
dag_run_id: data.dagRunId,
},
errors: {
400: "Bad Request",
401: "Unauthorized",
403: "Forbidden",
404: "Not Found",
422: "Validation Error",
},
});
}
}

export class DagSourceService {
Expand Down
38 changes: 38 additions & 0 deletions airflow/ui/openapi-gen/requests/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,13 @@ export type PatchDagRunData = {

export type PatchDagRunResponse = DAGRunResponse;

export type GetUpstreamAssetEventsData = {
dagId: string;
dagRunId: string;
};

export type GetUpstreamAssetEventsResponse = unknown;

export type GetDagSourceData = {
accept?: string;
fileToken: string;
Expand Down Expand Up @@ -1804,6 +1811,37 @@ export type $OpenApiTs = {
};
};
};
"/public/dags/{dag_id}/dagRuns/{dag_run_id}/upstreamDatasetEvents": {
get: {
req: GetUpstreamAssetEventsData;
res: {
/**
* Successful Response
*/
200: unknown;
/**
* Bad Request
*/
400: HTTPExceptionResponse;
/**
* Unauthorized
*/
401: HTTPExceptionResponse;
/**
* Forbidden
*/
403: HTTPExceptionResponse;
/**
* Not Found
*/
404: HTTPExceptionResponse;
/**
* Validation Error
*/
422: HTTPValidationError;
};
};
};
"/public/dagSources/{file_token}": {
get: {
req: GetDagSourceData;
Expand Down