milton0825 commented on a change in pull request #5128: [AIRFLOW-4307] Backfill
respects concurrency limit
URL: https://github.com/apache/airflow/pull/5128#discussion_r277119184
##########
File path: tests/test_jobs.py
##########
@@ -308,6 +308,37 @@ def test_backfill_conf(self):
self.assertEqual(conf, dr[0].conf)
+ def test_backfill_respect_concurrency_limit(self):
+
+ dag = self._get_dummy_dag('test_backfill_respect_concurrency_limit')
+ dag.concurrency = 2
+
+ executor = TestExecutor(do_update=True)
+
+ job = BackfillJob(
+ dag=dag,
+ executor=executor,
+ start_date=DEFAULT_DATE,
+ end_date=DEFAULT_DATE + datetime.timedelta(days=7),
+ )
+
+ job.run()
+
+ self.assertTrue(0 < len(executor.history))
+
+ concurrency_limit_reached_at_least_once = False
+
+ running_tis_total = 0
+
+ for running_tis in executor.history:
+ self.assertLessEqual(len(running_tis), dag.concurrency)
+ running_tis_total += len(running_tis)
+ if len(running_tis) == dag.concurrency:
+ concurrency_limit_reached_at_least_once = True
+
+ self.assertEquals(8, running_tis_total)
+ self.assertTrue(concurrency_limit_reached_at_least_once)
+
Review comment:
Agree. I have updated the tests to inspect `log.debug` and verify that we
are hitting the right threshold.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services