This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 8b0ac8d5302 Pass Task Instance ids in API response (#43664)
8b0ac8d5302 is described below
commit 8b0ac8d5302623d5ec0e19d108f337f8916c1109
Author: Kaxil Naik <[email protected]>
AuthorDate: Mon Nov 4 22:54:32 2024 +0000
Pass Task Instance ids in API response (#43664)
https://github.com/apache/airflow/pull/43243 added Task Instance "id" as
primary key. This PR passes the same API to API responses.
---
airflow/api_fastapi/core_api/openapi/v1-generated.yaml | 4 ++++
airflow/api_fastapi/core_api/serializers/task_instances.py | 1 +
airflow/ui/openapi-gen/requests/schemas.gen.ts | 5 +++++
airflow/ui/openapi-gen/requests/types.gen.ts | 1 +
tests/api_fastapi/core_api/routes/public/test_task_instances.py | 6 ++++++
5 files changed, 17 insertions(+)
diff --git a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml
b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml
index a82e34a3f5e..abd7f0baf5e 100644
--- a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml
+++ b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml
@@ -3667,6 +3667,9 @@ components:
description: Schema for Scheduler info.
TaskInstanceResponse:
properties:
+ id:
+ type: string
+ title: Id
task_id:
type: string
title: Task Id
@@ -3787,6 +3790,7 @@ components:
- type: 'null'
type: object
required:
+ - id
- task_id
- dag_id
- dag_run_id
diff --git a/airflow/api_fastapi/core_api/serializers/task_instances.py
b/airflow/api_fastapi/core_api/serializers/task_instances.py
index b8a10e8fb86..07ef42d8e24 100644
--- a/airflow/api_fastapi/core_api/serializers/task_instances.py
+++ b/airflow/api_fastapi/core_api/serializers/task_instances.py
@@ -31,6 +31,7 @@ class TaskInstanceResponse(BaseModel):
model_config = ConfigDict(populate_by_name=True)
+ id: str
task_id: str
dag_id: str
run_id: str = Field(alias="dag_run_id")
diff --git a/airflow/ui/openapi-gen/requests/schemas.gen.ts
b/airflow/ui/openapi-gen/requests/schemas.gen.ts
index 5624358636c..cf51451c98b 100644
--- a/airflow/ui/openapi-gen/requests/schemas.gen.ts
+++ b/airflow/ui/openapi-gen/requests/schemas.gen.ts
@@ -2300,6 +2300,10 @@ export const $SchedulerInfoSchema = {
export const $TaskInstanceResponse = {
properties: {
+ id: {
+ type: "string",
+ title: "Id",
+ },
task_id: {
type: "string",
title: "Task Id",
@@ -2529,6 +2533,7 @@ export const $TaskInstanceResponse = {
},
type: "object",
required: [
+ "id",
"task_id",
"dag_id",
"dag_run_id",
diff --git a/airflow/ui/openapi-gen/requests/types.gen.ts
b/airflow/ui/openapi-gen/requests/types.gen.ts
index 2c11dd03cc0..18d5bc296eb 100644
--- a/airflow/ui/openapi-gen/requests/types.gen.ts
+++ b/airflow/ui/openapi-gen/requests/types.gen.ts
@@ -536,6 +536,7 @@ export type SchedulerInfoSchema = {
* TaskInstance serializer for responses.
*/
export type TaskInstanceResponse = {
+ id: string;
task_id: string;
dag_id: string;
dag_run_id: string;
diff --git a/tests/api_fastapi/core_api/routes/public/test_task_instances.py
b/tests/api_fastapi/core_api/routes/public/test_task_instances.py
index 717f17ca278..0f27abd567e 100644
--- a/tests/api_fastapi/core_api/routes/public/test_task_instances.py
+++ b/tests/api_fastapi/core_api/routes/public/test_task_instances.py
@@ -19,6 +19,7 @@ from __future__ import annotations
import datetime as dt
import urllib
+from unittest import mock
import pendulum
import pytest
@@ -180,6 +181,7 @@ class TestGetTaskInstance(TestTaskInstanceEndpoint):
"executor": None,
"executor_config": "{}",
"hostname": "",
+ "id": mock.ANY,
"map_index": -1,
"max_tries": 0,
"note": "placeholder-note",
@@ -237,6 +239,7 @@ class TestGetTaskInstance(TestTaskInstanceEndpoint):
"executor": None,
"executor_config": "{}",
"hostname": "",
+ "id": mock.ANY,
"map_index": -1,
"max_tries": 0,
"note": "placeholder-note",
@@ -283,6 +286,7 @@ class TestGetTaskInstance(TestTaskInstanceEndpoint):
"executor": None,
"executor_config": "{}",
"hostname": "",
+ "id": mock.ANY,
"map_index": -1,
"max_tries": 0,
"note": "placeholder-note",
@@ -325,6 +329,7 @@ class TestGetTaskInstance(TestTaskInstanceEndpoint):
"executor": None,
"executor_config": "{}",
"hostname": "",
+ "id": mock.ANY,
"map_index": -1,
"max_tries": 0,
"note": "placeholder-note",
@@ -424,6 +429,7 @@ class TestGetMappedTaskInstance(TestTaskInstanceEndpoint):
"executor": None,
"executor_config": "{}",
"hostname": "",
+ "id": mock.ANY,
"map_index": map_index,
"max_tries": 0,
"note": "placeholder-note",