uranusjr commented on code in PR #32009:
URL: https://github.com/apache/airflow/pull/32009#discussion_r1234874219
##########
airflow/sensors/external_task.py:
##########
@@ -367,10 +367,15 @@ def get_count(self, dttm_filter, session, states) -> int:
elif self.external_task_group_id:
external_task_group_task_ids =
self.get_external_task_group_task_ids(session, dttm_filter)
count = (
- self._count_query(TI, session, states, dttm_filter)
- .filter(tuple_in_condition((TI.task_id, TI.map_index),
external_task_group_task_ids))
- .scalar()
- ) / len(external_task_group_task_ids)
+ 0
+ if not external_task_group_task_ids
+ else (
+ self._count_query(TI, session, states, dttm_filter)
+ .filter(tuple_in_condition((TI.task_id, TI.map_index),
external_task_group_task_ids))
+ .scalar()
+ )
+ / len(external_task_group_task_ids)
+ )
Review Comment:
This is a bit too complicated, let’s use the good old if-else blocks here.
--
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]