pierrejeambrun commented on code in PR #53087:
URL: https://github.com/apache/airflow/pull/53087#discussion_r2194827932
##########
airflow-core/src/airflow/api_fastapi/core_api/datamodels/ui/common.py:
##########
@@ -81,9 +82,10 @@ class GridRunsResponse(BaseModel):
@computed_field
def duration(self) -> int | None:
- if self.start_date and self.end_date:
- return (self.end_date - self.start_date).seconds
- return None
+ if self.start_date:
+ end_date = self.end_date or timezone.utcnow()
+ return (end_date - self.start_date).seconds
+ return 0
Review Comment:
None would cause the front-end to `Nan` when displaying the duration, and
all duration would be crunched to '0'.
Here if DagRun didn't start for some reason, Duration is 0.
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py:
##########
@@ -480,7 +480,6 @@ def get_grid_runs(
)
),
],
- response_model_exclude_none=True,
Review Comment:
This is what cause `state: None` to be omitted.
##########
airflow-core/src/airflow/api_fastapi/core_api/services/ui/grid.py:
##########
@@ -326,7 +326,7 @@ def agg_state(states):
def _get_aggs_for_node(detail):
- states = [x["state"] for x in detail if x["state"] is not None]
+ states = [x["state"] for x in detail if x["state"]]
Review Comment:
None should be considered, it is a valid state (no_status)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]