Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -7406,137 +7406,6 @@ paths:
- OAuth2PasswordBearer: []
- HTTPBearer: []
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
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateHITLDetailPayload'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/HITLDetailResponse'
'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
'409':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Conflict
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
get:
tags:
- HumanInTheLoop
summary: Get Hitl Detail
description: Get a Human-in-the-loop detail of a specific task instance.
operationId: get_hitl_detail
security:
- OAuth2PasswordBearer: []
- HTTPBearer: []
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/HITLDetail'
'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'
/api/v2/hitlDetails/{dag_id}/{dag_run_id}/{task_id}/{map_index}:
patch:
tags:
- HumanInTheLoop
summary: Update Mapped Ti Hitl Detail
description: Update a Human-in-the-loop detail.
operationId: update_mapped_ti_hitl_detail
security:
- OAuth2PasswordBearer: []
- HTTPBearer: []
parameters:
- name: dag_id
in: path
required: true
Expand All @@ -7556,10 +7425,11 @@ paths:
type: string
title: Task Id
- name: map_index
in: path
required: true
in: query
required: false
schema:
type: integer
default: -1
title: Map Index
requestBody:
required: true
Expand Down Expand Up @@ -7607,9 +7477,9 @@ paths:
get:
tags:
- HumanInTheLoop
summary: Get Mapped Ti Hitl Detail
summary: Get Hitl Detail
description: Get a Human-in-the-loop detail of a specific task instance.
operationId: get_mapped_ti_hitl_detail
operationId: get_hitl_detail
security:
- OAuth2PasswordBearer: []
- HTTPBearer: []
Expand All @@ -7633,10 +7503,11 @@ paths:
type: string
title: Task Id
- name: map_index
in: path
required: true
in: query
required: false
schema:
type: integer
default: -1
title: Map Index
responses:
'200':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _get_task_instance(
dag_run_id: str,
task_id: str,
session: SessionDep,
map_index: int | None = None,
map_index: int,
) -> TI:
query = select(TI).where(
TI.dag_id == dag_id,
Expand All @@ -83,11 +83,6 @@ def _get_task_instance(
f"task_id: `{task_id}` and map_index: `{map_index}` was not found"
),
)
if map_index is None and task_instance.map_index != -1:
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND,
detail="Task instance is mapped, add the map_index value to the URL",
)

return task_instance

Expand All @@ -99,7 +94,7 @@ def _update_hitl_detail(
update_hitl_detail_payload: UpdateHITLDetailPayload,
user: GetUserDep,
session: SessionDep,
map_index: int | None = None,
map_index: int,
) -> HITLDetailResponse:
task_instance = _get_task_instance(
dag_id=dag_id,
Expand Down Expand Up @@ -151,7 +146,7 @@ def _get_hitl_detail(
dag_run_id: str,
task_id: str,
session: SessionDep,
map_index: int | None = None,
map_index: int,
) -> HITLDetail:
"""Get a Human-in-the-loop detail of a specific task instance."""
task_instance = _get_task_instance(
Expand Down Expand Up @@ -195,38 +190,7 @@ def update_hitl_detail(
update_hitl_detail_payload: UpdateHITLDetailPayload,
user: GetUserDep,
session: SessionDep,
) -> HITLDetailResponse:
"""Update a Human-in-the-loop detail."""
return _update_hitl_detail(
dag_id=dag_id,
dag_run_id=dag_run_id,
task_id=task_id,
session=session,
update_hitl_detail_payload=update_hitl_detail_payload,
user=user,
map_index=None,
)


@hitl_router.patch(
"/{dag_id}/{dag_run_id}/{task_id}/{map_index}",
responses=create_openapi_http_exception_doc(
[
status.HTTP_403_FORBIDDEN,
status.HTTP_404_NOT_FOUND,
status.HTTP_409_CONFLICT,
]
),
dependencies=[Depends(requires_access_dag(method="PUT", access_entity=DagAccessEntity.HITL_DETAIL))],
)
def update_mapped_ti_hitl_detail(
dag_id: str,
dag_run_id: str,
task_id: str,
update_hitl_detail_payload: UpdateHITLDetailPayload,
user: GetUserDep,
session: SessionDep,
map_index: int,
map_index: int = -1,
) -> HITLDetailResponse:
"""Update a Human-in-the-loop detail."""
return _update_hitl_detail(
Expand All @@ -251,29 +215,7 @@ def get_hitl_detail(
dag_run_id: str,
task_id: str,
session: SessionDep,
) -> HITLDetail:
"""Get a Human-in-the-loop detail of a specific task instance."""
return _get_hitl_detail(
dag_id=dag_id,
dag_run_id=dag_run_id,
task_id=task_id,
session=session,
map_index=None,
)


@hitl_router.get(
"/{dag_id}/{dag_run_id}/{task_id}/{map_index}",
status_code=status.HTTP_200_OK,
responses=create_openapi_http_exception_doc([status.HTTP_404_NOT_FOUND]),
dependencies=[Depends(requires_access_dag(method="GET", access_entity=DagAccessEntity.HITL_DETAIL))],
)
def get_mapped_ti_hitl_detail(
dag_id: str,
dag_run_id: str,
task_id: str,
session: SessionDep,
map_index: int,
map_index: int = -1,
) -> HITLDetail:
"""Get a Human-in-the-loop detail of a specific task instance."""
return _get_hitl_detail(
Expand Down
15 changes: 3 additions & 12 deletions airflow-core/src/airflow/ui/openapi-gen/queries/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,20 +643,12 @@ export const UseDagVersionServiceGetDagVersionsKeyFn = ({ bundleName, bundleVers
export type HumanInTheLoopServiceGetHitlDetailDefaultResponse = Awaited<ReturnType<typeof HumanInTheLoopService.getHitlDetail>>;
export type HumanInTheLoopServiceGetHitlDetailQueryResult<TData = HumanInTheLoopServiceGetHitlDetailDefaultResponse, TError = unknown> = UseQueryResult<TData, TError>;
export const useHumanInTheLoopServiceGetHitlDetailKey = "HumanInTheLoopServiceGetHitlDetail";
export const UseHumanInTheLoopServiceGetHitlDetailKeyFn = ({ dagId, dagRunId, taskId }: {
export const UseHumanInTheLoopServiceGetHitlDetailKeyFn = ({ dagId, dagRunId, mapIndex, taskId }: {
dagId: string;
dagRunId: string;
mapIndex?: number;
taskId: string;
}, queryKey?: Array<unknown>) => [useHumanInTheLoopServiceGetHitlDetailKey, ...(queryKey ?? [{ dagId, dagRunId, taskId }])];
export type HumanInTheLoopServiceGetMappedTiHitlDetailDefaultResponse = Awaited<ReturnType<typeof HumanInTheLoopService.getMappedTiHitlDetail>>;
export type HumanInTheLoopServiceGetMappedTiHitlDetailQueryResult<TData = HumanInTheLoopServiceGetMappedTiHitlDetailDefaultResponse, TError = unknown> = UseQueryResult<TData, TError>;
export const useHumanInTheLoopServiceGetMappedTiHitlDetailKey = "HumanInTheLoopServiceGetMappedTiHitlDetail";
export const UseHumanInTheLoopServiceGetMappedTiHitlDetailKeyFn = ({ dagId, dagRunId, mapIndex, taskId }: {
dagId: string;
dagRunId: string;
mapIndex: number;
taskId: string;
}, queryKey?: Array<unknown>) => [useHumanInTheLoopServiceGetMappedTiHitlDetailKey, ...(queryKey ?? [{ dagId, dagRunId, mapIndex, taskId }])];
}, queryKey?: Array<unknown>) => [useHumanInTheLoopServiceGetHitlDetailKey, ...(queryKey ?? [{ dagId, dagRunId, mapIndex, taskId }])];
export type HumanInTheLoopServiceGetHitlDetailsDefaultResponse = Awaited<ReturnType<typeof HumanInTheLoopService.getHitlDetails>>;
export type HumanInTheLoopServiceGetHitlDetailsQueryResult<TData = HumanInTheLoopServiceGetHitlDetailsDefaultResponse, TError = unknown> = UseQueryResult<TData, TError>;
export const useHumanInTheLoopServiceGetHitlDetailsKey = "HumanInTheLoopServiceGetHitlDetails";
Expand Down Expand Up @@ -808,7 +800,6 @@ export type XcomServiceUpdateXcomEntryMutationResult = Awaited<ReturnType<typeof
export type VariableServicePatchVariableMutationResult = Awaited<ReturnType<typeof VariableService.patchVariable>>;
export type VariableServiceBulkVariablesMutationResult = Awaited<ReturnType<typeof VariableService.bulkVariables>>;
export type HumanInTheLoopServiceUpdateHitlDetailMutationResult = Awaited<ReturnType<typeof HumanInTheLoopService.updateHitlDetail>>;
export type HumanInTheLoopServiceUpdateMappedTiHitlDetailMutationResult = Awaited<ReturnType<typeof HumanInTheLoopService.updateMappedTiHitlDetail>>;
export type AssetServiceDeleteAssetQueuedEventsMutationResult = Awaited<ReturnType<typeof AssetService.deleteAssetQueuedEvents>>;
export type AssetServiceDeleteDagAssetQueuedEventsMutationResult = Awaited<ReturnType<typeof AssetService.deleteDagAssetQueuedEvents>>;
export type AssetServiceDeleteDagAssetQueuedEventMutationResult = Awaited<ReturnType<typeof AssetService.deleteDagAssetQueuedEvent>>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1217,31 +1217,16 @@ export const ensureUseDagVersionServiceGetDagVersionsData = (queryClient: QueryC
* @param data.dagId
* @param data.dagRunId
* @param data.taskId
* @returns HITLDetail Successful Response
* @throws ApiError
*/
export const ensureUseHumanInTheLoopServiceGetHitlDetailData = (queryClient: QueryClient, { dagId, dagRunId, taskId }: {
dagId: string;
dagRunId: string;
taskId: string;
}) => queryClient.ensureQueryData({ queryKey: Common.UseHumanInTheLoopServiceGetHitlDetailKeyFn({ dagId, dagRunId, taskId }), queryFn: () => HumanInTheLoopService.getHitlDetail({ dagId, dagRunId, taskId }) });
/**
* Get Mapped Ti Hitl Detail
* Get a Human-in-the-loop detail of a specific task instance.
* @param data The data for the request.
* @param data.dagId
* @param data.dagRunId
* @param data.taskId
* @param data.mapIndex
* @returns HITLDetail Successful Response
* @throws ApiError
*/
export const ensureUseHumanInTheLoopServiceGetMappedTiHitlDetailData = (queryClient: QueryClient, { dagId, dagRunId, mapIndex, taskId }: {
export const ensureUseHumanInTheLoopServiceGetHitlDetailData = (queryClient: QueryClient, { dagId, dagRunId, mapIndex, taskId }: {
dagId: string;
dagRunId: string;
mapIndex: number;
mapIndex?: number;
taskId: string;
}) => queryClient.ensureQueryData({ queryKey: Common.UseHumanInTheLoopServiceGetMappedTiHitlDetailKeyFn({ dagId, dagRunId, mapIndex, taskId }), queryFn: () => HumanInTheLoopService.getMappedTiHitlDetail({ dagId, dagRunId, mapIndex, taskId }) });
}) => queryClient.ensureQueryData({ queryKey: Common.UseHumanInTheLoopServiceGetHitlDetailKeyFn({ dagId, dagRunId, mapIndex, taskId }), queryFn: () => HumanInTheLoopService.getHitlDetail({ dagId, dagRunId, mapIndex, taskId }) });
/**
* Get Hitl Details
* Get Human-in-the-loop details.
Expand Down
21 changes: 3 additions & 18 deletions airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1217,31 +1217,16 @@ export const prefetchUseDagVersionServiceGetDagVersions = (queryClient: QueryCli
* @param data.dagId
* @param data.dagRunId
* @param data.taskId
* @returns HITLDetail Successful Response
* @throws ApiError
*/
export const prefetchUseHumanInTheLoopServiceGetHitlDetail = (queryClient: QueryClient, { dagId, dagRunId, taskId }: {
dagId: string;
dagRunId: string;
taskId: string;
}) => queryClient.prefetchQuery({ queryKey: Common.UseHumanInTheLoopServiceGetHitlDetailKeyFn({ dagId, dagRunId, taskId }), queryFn: () => HumanInTheLoopService.getHitlDetail({ dagId, dagRunId, taskId }) });
/**
* Get Mapped Ti Hitl Detail
* Get a Human-in-the-loop detail of a specific task instance.
* @param data The data for the request.
* @param data.dagId
* @param data.dagRunId
* @param data.taskId
* @param data.mapIndex
* @returns HITLDetail Successful Response
* @throws ApiError
*/
export const prefetchUseHumanInTheLoopServiceGetMappedTiHitlDetail = (queryClient: QueryClient, { dagId, dagRunId, mapIndex, taskId }: {
export const prefetchUseHumanInTheLoopServiceGetHitlDetail = (queryClient: QueryClient, { dagId, dagRunId, mapIndex, taskId }: {
dagId: string;
dagRunId: string;
mapIndex: number;
mapIndex?: number;
taskId: string;
}) => queryClient.prefetchQuery({ queryKey: Common.UseHumanInTheLoopServiceGetMappedTiHitlDetailKeyFn({ dagId, dagRunId, mapIndex, taskId }), queryFn: () => HumanInTheLoopService.getMappedTiHitlDetail({ dagId, dagRunId, mapIndex, taskId }) });
}) => queryClient.prefetchQuery({ queryKey: Common.UseHumanInTheLoopServiceGetHitlDetailKeyFn({ dagId, dagRunId, mapIndex, taskId }), queryFn: () => HumanInTheLoopService.getHitlDetail({ dagId, dagRunId, mapIndex, taskId }) });
/**
* Get Hitl Details
* Get Human-in-the-loop details.
Expand Down
Loading
Loading