uranusjr commented on code in PR #32318:
URL: https://github.com/apache/airflow/pull/32318#discussion_r1259239902
##########
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:
Can we use `CASE` instead? We don’t really need to put them last, just
probably not at the very beginning.
##########
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:
Can we use `CASE` instead? We don’t really need to put them last, just
probably not at the very beginning.
--
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]