dstandish commented on code in PR #23924:
URL: https://github.com/apache/airflow/pull/23924#discussion_r882323655
##########
airflow/www/views.py:
##########
@@ -258,7 +258,11 @@ def task_group_to_grid(task_item_or_group, dag, dag_runs,
session):
if isinstance(task_item_or_group, AbstractOperator):
return {
'id': task_item_or_group.task_id,
- 'instances': [wwwutils.get_task_summary(dr, task_item_or_group,
session) for dr in dag_runs],
+ 'instances': [
+ ts
+ for ts in (wwwutils.get_task_summary(dr, task_item_or_group,
session) for dr in dag_runs)
+ if ts is not None
+ ],
Review Comment:
just to throw out another option,
```suggestion
'instances': filter(
lambda x: x is not None,
(wwwutils.get_task_summary(dr, task_item_or_group, session)
for dr in dag_runs),
),
```
don't know if it also needs to be wrapped with `list`. i know we tend to
prefer comprehension over map etc, but in this case it saves you that `ts`
variable, which, since we're already iterating over DRs, is a tiny bit more
cognitive load i thought.
--
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]