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 2019/04/30 17:57:08 UTC

[GitHub] [airflow] feng-tao commented on a change in pull request #5210: [AIRFLOW-4419] Restore used_slots and queued_slots Pool methods

feng-tao commented on a change in pull request #5210: [AIRFLOW-4419] Restore used_slots and queued_slots Pool methods
URL: https://github.com/apache/airflow/pull/5210#discussion_r279868168
 
 

 ##########
 File path: airflow/models/pool.py
 ##########
 @@ -64,6 +95,8 @@ def open_slots(self, session):
         from airflow.models.taskinstance import \
             TaskInstance as TI  # Avoid circular import
 
+        # Issue a single query instead of using the used_slots/queued_slots to
+        # avoid load on DB
         used_slots = session.query(func.count()).filter(TI.pool == self.pool).filter(
             TI.state.in_([State.RUNNING, State.QUEUED])).scalar()
         return self.slots - used_slots
 
 Review comment:
   used_slot already include both tasks in running state and queued state. So no need to minus the queued slots.

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


With regards,
Apache Git Services