Skip to content

Commit

Permalink
AIP-84 Add patch task_instance dry_run endpoint (apache#46018)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrejeambrun authored Jan 28, 2025
1 parent 57d26ac commit 825df6d
Show file tree
Hide file tree
Showing 9 changed files with 967 additions and 139 deletions.
3 changes: 1 addition & 2 deletions airflow/api_fastapi/core_api/datamodels/task_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,7 @@ def validate_model(cls, data: Any) -> Any:
class PatchTaskInstanceBody(BaseModel):
"""Request body for Clear Task Instances endpoint."""

dry_run: bool = True
new_state: str | None = None
new_state: TaskInstanceState | None = None
note: Annotated[str, StringConstraints(max_length=1000)] | None = None
include_upstream: bool = False
include_downstream: bool = False
Expand Down
194 changes: 186 additions & 8 deletions airflow/api_fastapi/core_api/openapi/v1-generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4518,7 +4518,7 @@ paths:
tags:
- Task Instance
summary: Patch Task Instance
description: Update the state of a task instance.
description: Update a task instance.
operationId: patch_task_instance
parameters:
- name: dag_id
Expand Down Expand Up @@ -5125,7 +5125,7 @@ paths:
tags:
- Task Instance
summary: Patch Task Instance
description: Update the state of a task instance.
description: Update a task instance.
operationId: patch_task_instance
parameters:
- name: dag_id
Expand Down Expand Up @@ -5675,6 +5675,189 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/{map_index}/dry_run:
patch:
tags:
- Task Instance
summary: Patch Task Instance Dry Run
description: Update a task instance dry_run mode.
operationId: patch_task_instance_dry_run
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
- name: map_index
in: path
required: true
schema:
type: integer
title: Map Index
- name: update_mask
in: query
required: false
schema:
anyOf:
- type: array
items:
type: string
- type: 'null'
title: Update Mask
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PatchTaskInstanceBody'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/TaskInstanceCollectionResponse'
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Forbidden
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Bad Request
'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'
/public/dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/dry_run:
patch:
tags:
- Task Instance
summary: Patch Task Instance Dry Run
description: Update a task instance dry_run mode.
operationId: patch_task_instance_dry_run
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
- name: map_index
in: query
required: false
schema:
type: integer
default: -1
title: Map Index
- name: update_mask
in: query
required: false
schema:
anyOf:
- type: array
items:
type: string
- type: 'null'
title: Update Mask
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PatchTaskInstanceBody'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/TaskInstanceCollectionResponse'
'401':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Unauthorized
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Forbidden
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPExceptionResponse'
description: Bad Request
'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'
/public/dags/{dag_id}/tasks:
get:
tags:
Expand Down Expand Up @@ -8931,15 +9114,10 @@ components:
description: Node serializer for responses.
PatchTaskInstanceBody:
properties:
dry_run:
type: boolean
title: Dry Run
default: true
new_state:
anyOf:
- type: string
- $ref: '#/components/schemas/TaskInstanceState'
- type: 'null'
title: New State
note:
anyOf:
- type: string
Expand Down
Loading

0 comments on commit 825df6d

Please sign in to comment.