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 ccb18abdba2 Fix duplicate `TaskInstanceState` entity in FastApi Schema
(#43824)
ccb18abdba2 is described below
commit ccb18abdba26978c31db6bd3407689c73322273c
Author: Kaxil Naik <[email protected]>
AuthorDate: Fri Nov 8 14:16:02 2024 +0000
Fix duplicate `TaskInstanceState` entity in FastApi Schema (#43824)
It was the cause of
https://github.com/apache/airflow/pull/43823#discussion_r1834409827
```
airflow__api_fastapi__core_api__datamodels__ui__dashboard__TaskInstanceState
TaskInstanceState
```
---
.../core_api/datamodels/ui/dashboard.py | 4 +-
.../api_fastapi/core_api/openapi/v1-generated.yaml | 160 ++++++++---------
airflow/ui/openapi-gen/requests/schemas.gen.ts | 199 ++++++++++-----------
airflow/ui/openapi-gen/requests/types.gen.ts | 81 +++++----
4 files changed, 221 insertions(+), 223 deletions(-)
diff --git a/airflow/api_fastapi/core_api/datamodels/ui/dashboard.py
b/airflow/api_fastapi/core_api/datamodels/ui/dashboard.py
index 66adc8ed3df..ca0b5d98986 100644
--- a/airflow/api_fastapi/core_api/datamodels/ui/dashboard.py
+++ b/airflow/api_fastapi/core_api/datamodels/ui/dashboard.py
@@ -37,7 +37,7 @@ class DAGRunStates(BaseModel):
failed: int
-class TaskInstanceState(BaseModel):
+class TaskInstanceStateCount(BaseModel):
"""TaskInstance serializer for responses."""
no_status: int
@@ -60,4 +60,4 @@ class HistoricalMetricDataResponse(BaseModel):
dag_run_types: DAGRunTypes
dag_run_states: DAGRunStates
- task_instance_states: TaskInstanceState
+ task_instance_states: TaskInstanceStateCount
diff --git a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml
b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml
index a4e270ed7e6..e938c459455 100644
--- a/airflow/api_fastapi/core_api/openapi/v1-generated.yaml
+++ b/airflow/api_fastapi/core_api/openapi/v1-generated.yaml
@@ -4336,7 +4336,7 @@ components:
dag_run_states:
$ref: '#/components/schemas/DAGRunStates'
task_instance_states:
- $ref:
'#/components/schemas/airflow__api_fastapi__core_api__datamodels__ui__dashboard__TaskInstanceState'
+ $ref: '#/components/schemas/TaskInstanceStateCount'
type: object
required:
- dag_run_types
@@ -4798,7 +4798,7 @@ components:
title: Duration
state:
anyOf:
- - $ref:
'#/components/schemas/airflow__utils__state__TaskInstanceState'
+ - $ref: '#/components/schemas/TaskInstanceState'
- type: 'null'
try_number:
type: integer
@@ -4913,6 +4913,84 @@ components:
- triggerer_job
title: TaskInstanceResponse
description: TaskInstance serializer for responses.
+ TaskInstanceState:
+ type: string
+ enum:
+ - removed
+ - scheduled
+ - queued
+ - running
+ - success
+ - restarting
+ - failed
+ - up_for_retry
+ - up_for_reschedule
+ - upstream_failed
+ - skipped
+ - deferred
+ title: TaskInstanceState
+ description: 'All possible states that a Task Instance can be in.
+
+
+ Note that None is also allowed, so always use this in a type hint with
Optional.'
+ TaskInstanceStateCount:
+ properties:
+ no_status:
+ type: integer
+ title: No Status
+ removed:
+ type: integer
+ title: Removed
+ scheduled:
+ type: integer
+ title: Scheduled
+ queued:
+ type: integer
+ title: Queued
+ running:
+ type: integer
+ title: Running
+ success:
+ type: integer
+ title: Success
+ restarting:
+ type: integer
+ title: Restarting
+ failed:
+ type: integer
+ title: Failed
+ up_for_retry:
+ type: integer
+ title: Up For Retry
+ up_for_reschedule:
+ type: integer
+ title: Up For Reschedule
+ upstream_failed:
+ type: integer
+ title: Upstream Failed
+ skipped:
+ type: integer
+ title: Skipped
+ deferred:
+ type: integer
+ title: Deferred
+ type: object
+ required:
+ - no_status
+ - removed
+ - scheduled
+ - queued
+ - running
+ - success
+ - restarting
+ - failed
+ - up_for_retry
+ - up_for_reschedule
+ - upstream_failed
+ - skipped
+ - deferred
+ title: TaskInstanceStateCount
+ description: TaskInstance serializer for responses.
TriggerResponse:
properties:
id:
@@ -5056,81 +5134,3 @@ components:
- git_version
title: VersionInfo
description: Version information serializer for responses.
-
airflow__api_fastapi__core_api__datamodels__ui__dashboard__TaskInstanceState:
- properties:
- no_status:
- type: integer
- title: No Status
- removed:
- type: integer
- title: Removed
- scheduled:
- type: integer
- title: Scheduled
- queued:
- type: integer
- title: Queued
- running:
- type: integer
- title: Running
- success:
- type: integer
- title: Success
- restarting:
- type: integer
- title: Restarting
- failed:
- type: integer
- title: Failed
- up_for_retry:
- type: integer
- title: Up For Retry
- up_for_reschedule:
- type: integer
- title: Up For Reschedule
- upstream_failed:
- type: integer
- title: Upstream Failed
- skipped:
- type: integer
- title: Skipped
- deferred:
- type: integer
- title: Deferred
- type: object
- required:
- - no_status
- - removed
- - scheduled
- - queued
- - running
- - success
- - restarting
- - failed
- - up_for_retry
- - up_for_reschedule
- - upstream_failed
- - skipped
- - deferred
- title: TaskInstanceState
- description: TaskInstance serializer for responses.
- airflow__utils__state__TaskInstanceState:
- type: string
- enum:
- - removed
- - scheduled
- - queued
- - running
- - success
- - restarting
- - failed
- - up_for_retry
- - up_for_reschedule
- - upstream_failed
- - skipped
- - deferred
- title: TaskInstanceState
- description: 'All possible states that a Task Instance can be in.
-
-
- Note that None is also allowed, so always use this in a type hint with
Optional.'
diff --git a/airflow/ui/openapi-gen/requests/schemas.gen.ts
b/airflow/ui/openapi-gen/requests/schemas.gen.ts
index 0e583e014f0..5199a04962f 100644
--- a/airflow/ui/openapi-gen/requests/schemas.gen.ts
+++ b/airflow/ui/openapi-gen/requests/schemas.gen.ts
@@ -1911,7 +1911,7 @@ export const $HistoricalMetricDataResponse = {
$ref: "#/components/schemas/DAGRunStates",
},
task_instance_states: {
- $ref:
"#/components/schemas/airflow__api_fastapi__core_api__datamodels__ui__dashboard__TaskInstanceState",
+ $ref: "#/components/schemas/TaskInstanceStateCount",
},
},
type: "object",
@@ -2585,7 +2585,7 @@ export const $TaskInstanceResponse = {
state: {
anyOf: [
{
- $ref:
"#/components/schemas/airflow__utils__state__TaskInstanceState",
+ $ref: "#/components/schemas/TaskInstanceState",
},
{
type: "null",
@@ -2788,6 +2788,103 @@ export const $TaskInstanceResponse = {
description: "TaskInstance serializer for responses.",
} as const;
+export const $TaskInstanceState = {
+ type: "string",
+ enum: [
+ "removed",
+ "scheduled",
+ "queued",
+ "running",
+ "success",
+ "restarting",
+ "failed",
+ "up_for_retry",
+ "up_for_reschedule",
+ "upstream_failed",
+ "skipped",
+ "deferred",
+ ],
+ title: "TaskInstanceState",
+ description: `All possible states that a Task Instance can be in.
+
+Note that None is also allowed, so always use this in a type hint with
Optional.`,
+} as const;
+
+export const $TaskInstanceStateCount = {
+ properties: {
+ no_status: {
+ type: "integer",
+ title: "No Status",
+ },
+ removed: {
+ type: "integer",
+ title: "Removed",
+ },
+ scheduled: {
+ type: "integer",
+ title: "Scheduled",
+ },
+ queued: {
+ type: "integer",
+ title: "Queued",
+ },
+ running: {
+ type: "integer",
+ title: "Running",
+ },
+ success: {
+ type: "integer",
+ title: "Success",
+ },
+ restarting: {
+ type: "integer",
+ title: "Restarting",
+ },
+ failed: {
+ type: "integer",
+ title: "Failed",
+ },
+ up_for_retry: {
+ type: "integer",
+ title: "Up For Retry",
+ },
+ up_for_reschedule: {
+ type: "integer",
+ title: "Up For Reschedule",
+ },
+ upstream_failed: {
+ type: "integer",
+ title: "Upstream Failed",
+ },
+ skipped: {
+ type: "integer",
+ title: "Skipped",
+ },
+ deferred: {
+ type: "integer",
+ title: "Deferred",
+ },
+ },
+ type: "object",
+ required: [
+ "no_status",
+ "removed",
+ "scheduled",
+ "queued",
+ "running",
+ "success",
+ "restarting",
+ "failed",
+ "up_for_retry",
+ "up_for_reschedule",
+ "upstream_failed",
+ "skipped",
+ "deferred",
+ ],
+ title: "TaskInstanceStateCount",
+ description: "TaskInstance serializer for responses.",
+} as const;
+
export const $TriggerResponse = {
properties: {
id: {
@@ -2999,101 +3096,3 @@ export const $VersionInfo = {
title: "VersionInfo",
description: "Version information serializer for responses.",
} as const;
-
-export const
$airflow__api_fastapi__core_api__datamodels__ui__dashboard__TaskInstanceState =
- {
- properties: {
- no_status: {
- type: "integer",
- title: "No Status",
- },
- removed: {
- type: "integer",
- title: "Removed",
- },
- scheduled: {
- type: "integer",
- title: "Scheduled",
- },
- queued: {
- type: "integer",
- title: "Queued",
- },
- running: {
- type: "integer",
- title: "Running",
- },
- success: {
- type: "integer",
- title: "Success",
- },
- restarting: {
- type: "integer",
- title: "Restarting",
- },
- failed: {
- type: "integer",
- title: "Failed",
- },
- up_for_retry: {
- type: "integer",
- title: "Up For Retry",
- },
- up_for_reschedule: {
- type: "integer",
- title: "Up For Reschedule",
- },
- upstream_failed: {
- type: "integer",
- title: "Upstream Failed",
- },
- skipped: {
- type: "integer",
- title: "Skipped",
- },
- deferred: {
- type: "integer",
- title: "Deferred",
- },
- },
- type: "object",
- required: [
- "no_status",
- "removed",
- "scheduled",
- "queued",
- "running",
- "success",
- "restarting",
- "failed",
- "up_for_retry",
- "up_for_reschedule",
- "upstream_failed",
- "skipped",
- "deferred",
- ],
- title: "TaskInstanceState",
- description: "TaskInstance serializer for responses.",
- } as const;
-
-export const $airflow__utils__state__TaskInstanceState = {
- type: "string",
- enum: [
- "removed",
- "scheduled",
- "queued",
- "running",
- "success",
- "restarting",
- "failed",
- "up_for_retry",
- "up_for_reschedule",
- "upstream_failed",
- "skipped",
- "deferred",
- ],
- title: "TaskInstanceState",
- description: `All possible states that a Task Instance can be in.
-
-Note that None is also allowed, so always use this in a type hint with
Optional.`,
-} as const;
diff --git a/airflow/ui/openapi-gen/requests/types.gen.ts
b/airflow/ui/openapi-gen/requests/types.gen.ts
index 2b96ab7140a..8817a45abd4 100644
--- a/airflow/ui/openapi-gen/requests/types.gen.ts
+++ b/airflow/ui/openapi-gen/requests/types.gen.ts
@@ -454,7 +454,7 @@ export type HealthInfoSchema = {
export type HistoricalMetricDataResponse = {
dag_run_types: DAGRunTypes;
dag_run_states: DAGRunStates;
- task_instance_states:
airflow__api_fastapi__core_api__datamodels__ui__dashboard__TaskInstanceState;
+ task_instance_states: TaskInstanceStateCount;
};
/**
@@ -629,7 +629,7 @@ export type TaskInstanceResponse = {
start_date: string | null;
end_date: string | null;
duration: number | null;
- state: airflow__utils__state__TaskInstanceState | null;
+ state: TaskInstanceState | null;
try_number: number;
max_tries: number;
task_display_name: string;
@@ -653,6 +653,44 @@ export type TaskInstanceResponse = {
triggerer_job: JobResponse | null;
};
+/**
+ * All possible states that a Task Instance can be in.
+ *
+ * Note that None is also allowed, so always use this in a type hint with
Optional.
+ */
+export type TaskInstanceState =
+ | "removed"
+ | "scheduled"
+ | "queued"
+ | "running"
+ | "success"
+ | "restarting"
+ | "failed"
+ | "up_for_retry"
+ | "up_for_reschedule"
+ | "upstream_failed"
+ | "skipped"
+ | "deferred";
+
+/**
+ * TaskInstance serializer for responses.
+ */
+export type TaskInstanceStateCount = {
+ no_status: number;
+ removed: number;
+ scheduled: number;
+ queued: number;
+ running: number;
+ success: number;
+ restarting: number;
+ failed: number;
+ up_for_retry: number;
+ up_for_reschedule: number;
+ upstream_failed: number;
+ skipped: number;
+ deferred: number;
+};
+
/**
* Trigger serializer for responses.
*/
@@ -712,45 +750,6 @@ export type VersionInfo = {
git_version: string | null;
};
-/**
- * TaskInstance serializer for responses.
- */
-export type
airflow__api_fastapi__core_api__datamodels__ui__dashboard__TaskInstanceState =
- {
- no_status: number;
- removed: number;
- scheduled: number;
- queued: number;
- running: number;
- success: number;
- restarting: number;
- failed: number;
- up_for_retry: number;
- up_for_reschedule: number;
- upstream_failed: number;
- skipped: number;
- deferred: number;
- };
-
-/**
- * All possible states that a Task Instance can be in.
- *
- * Note that None is also allowed, so always use this in a type hint with
Optional.
- */
-export type airflow__utils__state__TaskInstanceState =
- | "removed"
- | "scheduled"
- | "queued"
- | "running"
- | "success"
- | "restarting"
- | "failed"
- | "up_for_retry"
- | "up_for_reschedule"
- | "upstream_failed"
- | "skipped"
- | "deferred";
-
export type NextRunAssetsData = {
dagId: string;
};