uranusjr commented on code in PR #41232:
URL: https://github.com/apache/airflow/pull/41232#discussion_r1716608438
##########
airflow/models/trigger.py:
##########
@@ -308,3 +308,21 @@ def get_sorted_triggers(cls, capacity: int,
alive_triggerer_ids: list[int] | Sel
skip_locked=True,
)
return session.execute(query).all()
+
+ @classmethod
+ @internal_api_call
+ @provide_session
+ def filter_out_reassigned_triggers(
+ cls, triggerer_id: int, local_trigger_ids: set[int], session: Session
= NEW_SESSION
+ ) -> set[int]:
+ """
+ Get the triggers that reassigned to other triggerers.
+
+ :param triggerer_id: Current triggerer's id.
+ :param local_trigger_ids: The ids of triggers that running in this
triggerer.
+ :param session: The database session
+ """
+ reassigned_trigger_ids = session.scalars(
+ select(cls.id).where(cls.triggerer_id != triggerer_id,
cls.id.in_(local_trigger_ids))
+ ).all()
Review Comment:
```suggestion
)
```
Don’t need this, `set()` below resolves the query.
--
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]