ephraimbuddy commented on a change in pull request #20391:
URL: https://github.com/apache/airflow/pull/20391#discussion_r785483597
##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -289,8 +290,21 @@ def _executable_task_instances_to_queued(self, max_tis:
int, session: Session =
.filter(not_(DM.is_paused))
.filter(TI.state == TaskInstanceState.SCHEDULED)
.options(selectinload('dag_model'))
- .order_by(-TI.priority_weight, DR.execution_date)
)
+ if session.bind.dialect.name == "postgresql":
+ query = query.order_by(
+ TI.priority_weight.desc(),
+ TI.last_scheduling_decision.desc().nullsfirst(),
Review comment:
Using desc helps us go from the oldest date to recent. Using asc may
make it difficult to reach a dag that first hit the max_active_runs
--
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]