milton0825 commented on a change in pull request #4949: [AIRFLOW-1557] Backfill
should respect pool limit
URL: https://github.com/apache/airflow/pull/4949#discussion_r268375067
##########
File path: airflow/jobs.py
##########
@@ -2300,8 +2301,33 @@ def _per_task_process(task, key, ti, session=None):
self.log.debug('Adding %s to not_ready', ti)
ti_status.not_ready.add(key)
+ pool_name = self.pool
+ if self.pool:
+ pool = session.query(models.Pool) \
+ .filter(models.Pool.pool == self.pool) \
+ .first()
+ if pool is not None:
+ open_slots = pool.open_slots(session=session)
+ else:
+ open_slots = 0
+ self.log.warning(
+ "Tasks using non-existent pool '%s' will not be
scheduled",
+ pool,
+ )
+ else:
+ open_slots = conf.getint('core',
'non_pooled_backfill_task_slot_count')
+ pool_name = 'not_pooled'
+
for task in self.dag.topological_sort():
for key, ti in list(ti_status.to_run.items()):
+ if open_slots <= 0:
+ self.log.debug(
+ "Not scheduling since there are %s open slots in
pool %s",
+ open_slots, pool_name,
+ )
+ break
+ open_slots -= 1
Review comment:
Backfilling would not stop actually. We will wait here for later retry:
https://github.com/apache/airflow/blob/84a7a9e6cb81139a2b62996acbd8579aff576810/airflow/jobs.py#L2484-L2508
----------------------------------------------------------------
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