dstandish commented on code in PR #25959:
URL: https://github.com/apache/airflow/pull/25959#discussion_r961830626


##########
airflow/models/dagrun.py:
##########
@@ -252,19 +252,22 @@ def refresh_from_db(self, session: Session = NEW_SESSION) 
-> None:
 
     @classmethod
     @provide_session
-    def active_runs_of_dags(cls, dag_ids=None, only_running=False, 
session=None) -> Dict[str, int]:
+    def active_runs_of_dags(
+        cls,
+        dag_ids: Optional[Iterable[str]] = None,
+        only_running: bool = False,
+        session: Session = NEW_SESSION,
+    ) -> Dict[str, int]:
         """Get the number of active dag runs for each dag."""
         query = session.query(cls.dag_id, func.count('*'))
         if dag_ids is not None:
-            # 'set' called to avoid duplicate dag_ids, but converted back to 
'list'
-            # because SQLAlchemy doesn't accept a set here.
-            query = query.filter(cls.dag_id.in_(list(set(dag_ids))))
+            query = query.filter(cls.dag_id.in_(dag_ids))
         if only_running:
-            query = query.filter(cls.state == State.RUNNING)
+            query = query.filter(cls.state == DagRunState.RUNNING)
         else:
-            query = query.filter(cls.state.in_([State.RUNNING, State.QUEUED]))
+            query = query.filter(cls.state.in_([DagRunState.RUNNING, 
DagRunState.QUEUED]))
         query = query.group_by(cls.dag_id)
-        return {dag_id: count for dag_id, count in query.all()}

Review Comment:
   @uranusjr i think this was probably a mistake ... i.e. the removal of 
`.all()`, no?



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

Reply via email to