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 @@ -81,10 +81,10 @@ class GridRunsResponse(BaseModel):
run_type: DagRunType

@computed_field
def duration(self) -> int:
def duration(self) -> float:
if self.start_date:
end_date = self.end_date or timezone.utcnow()
return (end_date - self.start_date).seconds
return (end_date - self.start_date).total_seconds()
return 0


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,7 @@ components:
run_type:
$ref: '#/components/schemas/DagRunType'
duration:
type: integer
type: number
title: Duration
readOnly: true
type: object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7447,7 +7447,7 @@ export const $GridRunsResponse = {
'$ref': '#/components/schemas/DagRunType'
},
duration: {
type: 'integer',
type: 'number',
title: 'Duration',
readOnly: true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

GRID_RUN_1 = {
"dag_id": "test_dag",
"duration": 0,
"duration": 283996800.0,
"end_date": "2024-12-31T00:00:00Z",
"run_after": "2024-11-30T00:00:00Z",
"run_id": "run_1",
Expand All @@ -69,7 +69,7 @@

GRID_RUN_2 = {
"dag_id": "test_dag",
"duration": 0,
"duration": 283996800.0,
"end_date": "2024-12-31T00:00:00Z",
"run_after": "2024-11-30T00:00:00Z",
"run_id": "run_2",
Expand Down Expand Up @@ -528,7 +528,7 @@ def test_get_grid_runs(self, session, test_client):
assert response.json() == [
{
"dag_id": "test_dag",
"duration": 0,
"duration": 283996800.0,
"end_date": "2024-12-31T00:00:00Z",
"run_after": "2024-11-30T00:00:00Z",
"run_id": "run_1",
Expand All @@ -538,7 +538,7 @@ def test_get_grid_runs(self, session, test_client):
},
{
"dag_id": "test_dag",
"duration": 0,
"duration": 283996800.0,
"end_date": "2024-12-31T00:00:00Z",
"run_after": "2024-11-30T00:00:00Z",
"run_id": "run_2",
Expand Down