uranusjr commented on code in PR #32645:
URL: https://github.com/apache/airflow/pull/32645#discussion_r1266200184
##########
airflow/models/trigger.py:
##########
@@ -231,19 +245,23 @@ def assign_unassigned(cls, triggerer_id, capacity,
heartrate, session: Session =
capacity=capacity, alive_triggerer_ids=alive_triggerer_ids,
session=session
)
if trigger_ids_query:
- session.query(cls).filter(cls.id.in_([i.id for i in
trigger_ids_query])).update(
- {cls.triggerer_id: triggerer_id},
- synchronize_session=False,
+ session.execute(
+ update(cls)
+ .where(cls.id.in_([i.id for i in trigger_ids_query]))
+ .values(triggerer_id=triggerer_id)
+ .execution_options(synchronize_session=False)
)
+
session.commit()
@classmethod
def get_sorted_triggers(cls, capacity, alive_triggerer_ids, session):
- return with_row_locks(
- session.query(cls.id)
- .filter(or_(cls.triggerer_id.is_(None),
cls.triggerer_id.notin_(alive_triggerer_ids)))
+ query = with_row_locks(
+ select(cls.id)
+ .where(or_(cls.triggerer_id.is_(None),
cls.triggerer_id.notin_(alive_triggerer_ids)))
Review Comment:
```suggestion
.where(or_(cls.triggerer_id.is_(None),
cls.triggerer_id.not_in(alive_triggerer_ids)))
```
Same as the `is_not` situation
--
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]