You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/04/29 11:54:34 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #15585: `func.sum` may returns `Decimal` that break rest APIs.

kaxil commented on a change in pull request #15585:
URL: https://github.com/apache/airflow/pull/15585#discussion_r622980931



##########
File path: airflow/models/pool.py
##########
@@ -161,12 +161,13 @@ def occupied_slots(self, session: Session):
         """
         from airflow.models.taskinstance import TaskInstance  # Avoid circular import
 
-        return (
+        return int(
             session.query(func.sum(TaskInstance.pool_slots))
             .filter(TaskInstance.pool == self.pool)
             .filter(TaskInstance.state.in_(list(EXECUTION_STATES)))
             .scalar()
-        ) or 0
+            or 0

Review comment:
       Interesting I thought `.scalar()` should take care of it based on https://stackoverflow.com/a/53431701/5691525 too




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org