This is an automated email from the ASF dual-hosted git repository.

pierrejeambrun 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 4c1276baa5a Cleanup duration typing grid summaries (#53095)
4c1276baa5a is described below

commit 4c1276baa5ae1d0b014f7c1c750489fc4c1d9e01
Author: Pierre Jeambrun <[email protected]>
AuthorDate: Wed Jul 9 20:10:34 2025 +0200

    Cleanup duration typing grid summaries (#53095)
---
 .../src/airflow/api_fastapi/core_api/datamodels/ui/common.py     | 2 +-
 .../src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml    | 4 +---
 airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts  | 9 +--------
 airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts    | 2 +-
 airflow-core/src/airflow/ui/src/layouts/Details/Grid/Bar.tsx     | 2 +-
 5 files changed, 5 insertions(+), 14 deletions(-)

diff --git 
a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/ui/common.py 
b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/ui/common.py
index 4fedad08e1c..6089d6d55df 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/datamodels/ui/common.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/datamodels/ui/common.py
@@ -81,7 +81,7 @@ class GridRunsResponse(BaseModel):
     run_type: DagRunType
 
     @computed_field
-    def duration(self) -> int | None:
+    def duration(self) -> int:
         if self.start_date:
             end_date = self.end_date or timezone.utcnow()
             return (end_date - self.start_date).seconds
diff --git 
a/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml 
b/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml
index 3c7a4abae7c..450cdc3036e 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml
+++ b/airflow-core/src/airflow/api_fastapi/core_api/openapi/_private_ui.yaml
@@ -1728,9 +1728,7 @@ components:
         run_type:
           $ref: '#/components/schemas/DagRunType'
         duration:
-          anyOf:
-          - type: integer
-          - type: 'null'
+          type: integer
           title: Duration
           readOnly: true
       type: object
diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts 
b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
index 8089971c150..5a46ac9e847 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/requests/schemas.gen.ts
@@ -6859,14 +6859,7 @@ export const $GridRunsResponse = {
             '$ref': '#/components/schemas/DagRunType'
         },
         duration: {
-            anyOf: [
-                {
-                    type: 'integer'
-                },
-                {
-                    type: 'null'
-                }
-            ],
+            type: 'integer',
             title: 'Duration',
             readOnly: true
         }
diff --git a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts 
b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
index 733e2985098..ed4e32db57f 100644
--- a/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
+++ b/airflow-core/src/airflow/ui/openapi-gen/requests/types.gen.ts
@@ -1753,7 +1753,7 @@ export type GridRunsResponse = {
     run_after: string;
     state: TaskInstanceState | null;
     run_type: DagRunType;
-    readonly duration: number | null;
+    readonly duration: number;
 };
 
 /**
diff --git a/airflow-core/src/airflow/ui/src/layouts/Details/Grid/Bar.tsx 
b/airflow-core/src/airflow/ui/src/layouts/Details/Grid/Bar.tsx
index 933a0490ef9..3ddcdee64a5 100644
--- a/airflow-core/src/airflow/ui/src/layouts/Details/Grid/Bar.tsx
+++ b/airflow-core/src/airflow/ui/src/layouts/Details/Grid/Bar.tsx
@@ -65,7 +65,7 @@ export const Bar = ({ max, nodes, run }: Props) => {
           color="white"
           dagId={dagId}
           flexDir="column"
-          height={`${((run.duration ?? 0) / max) * BAR_HEIGHT}px`}
+          height={`${(run.duration / max) * BAR_HEIGHT}px`}
           justifyContent="flex-end"
           label={run.run_after}
           minHeight="14px"

Reply via email to