hussein-awala commented on code in PR #32318:
URL: https://github.com/apache/airflow/pull/32318#discussion_r1258846069
##########
airflow/models/trigger.py:
##########
@@ -241,8 +241,9 @@ def assign_unassigned(cls, triggerer_id, capacity,
heartrate, session: Session =
def get_sorted_triggers(cls, capacity, alive_triggerer_ids, session):
return with_row_locks(
session.query(cls.id)
+ .join(TaskInstance, cls.id == TaskInstance.trigger_id,
isouter=True)
.filter(or_(cls.triggerer_id.is_(None),
cls.triggerer_id.notin_(alive_triggerer_ids)))
- .order_by(cls.created_date)
+ .order_by(-TaskInstance.priority_weight, cls.created_date)
Review Comment:
For NULL, I can use `TaskInstance.priority_weight.desc().nulls_last()`, but
it seems like the lock (with_for_update) doesn't work with the outer join, I
will try to find a solution for that.
--
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]