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/10/16 17:41:32 UTC

[GitHub] [airflow] houqp commented on a change in pull request #6342: [AIRFLOW-5662] fix incorrect naming for scheduler used slot metric

houqp commented on a change in pull request #6342: [AIRFLOW-5662] fix incorrect naming for scheduler used slot metric
URL: https://github.com/apache/airflow/pull/6342#discussion_r335617211
 
 

 ##########
 File path: airflow/models/pool.py
 ##########
 @@ -107,3 +109,33 @@ def open_slots(self, session):
         Returns the number of slots open at the moment
         """
         return self.slots - self.occupied_slots(session)
+
+    @provide_session
+    def slots_stats(self, session) -> Dict:
+        from airflow.models.taskinstance import TaskInstance  # Avoid circular import
+
+        states_filter = STATES_TO_COUNT_AS_RUNNING | frozenset([State.RUNNING, State.QUEUED])
 
 Review comment:
   It is, this is to safe guard future changes that will add or remove states from `STATE_TO_COUNT_AS_RUNNING` set. The naming of that variable doesn't seem to guarantee it will only contain queued and running going forward. I can certainly remove this safe guard code if that's not the case.

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