uranusjr commented on a change in pull request #19860:
URL: https://github.com/apache/airflow/pull/19860#discussion_r767687007
##########
File path: tests/jobs/test_scheduler_job.py
##########
@@ -444,15 +452,17 @@ def test_find_executable_task_instances_pool(self,
dag_maker):
task_id_2 = 'dummydummy'
session = settings.Session()
with dag_maker(dag_id=dag_id, max_active_tasks=16, session=session):
- DummyOperator(task_id=task_id_1, pool='a')
- DummyOperator(task_id=task_id_2, pool='b')
+ DummyOperator(task_id=task_id_1, pool='a', priority_weight=2)
+ DummyOperator(task_id=task_id_2, pool='b', priority_weight=1)
self.scheduler_job = SchedulerJob(subdir=os.devnull)
dr1 = dag_maker.create_dagrun(run_type=DagRunType.SCHEDULED)
dr2 = dag_maker.create_dagrun_after(dr1, run_type=DagRunType.SCHEDULED)
- tis = dr1.task_instances + dr2.task_instances
+ tis = sorted(dr1.task_instances, key=lambda _ti: _ti.key) + sorted(
+ dr2.task_instances, key=lambda _ti: _ti.key
+ )
Review comment:
Since the tasks are deterministic, this may be more readable:
```suggestion
tis = [
dr1.get_task_instance(task_id_1, session=session),
dr1.get_task_instance(task_id_2, session=session),
dr2.get_task_instance(task_id_1, session=session),
dr2.get_task_instance(task_id_2, session=session),
]
```
--
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]