Use also builder's maxjobs setting in scheduler

Related: https://pagure.io/koji/issue/4038
This commit is contained in:
Tomas Kopecek 2024-03-04 15:45:02 +01:00
parent 212059d049
commit 8b554bd3ca

View file

@ -298,6 +298,7 @@ class TaskScheduler(object):
h_refused = refusals.get(task['task_id'], {})
for host in self.hosts_by_bin.get(task['_bin'], []):
if (host['ready'] and host['_ntasks'] < self.maxjobs and
host['_ntasks'] < host['data']['maxjobs'] and
host['capacity'] - host['_load'] > min_avail and
host['id'] not in h_refused):
task['_hosts'].append(host)
@ -324,7 +325,8 @@ class TaskScheduler(object):
[(h['name'], "%(_rank).2f" % h) for h in task['_hosts']])
for host in task['_hosts']:
if (host['capacity'] - host['_load'] > min_avail and
host['_ntasks'] < self.maxjobs):
host['_ntasks'] < self.maxjobs and
host['_ntasks'] < host['data']['maxjobs']):
# add run entry
self.assign(task, host)
# update our totals and rank
@ -535,6 +537,7 @@ class TaskScheduler(object):
('host.ready', 'ready'),
('host_config.arches', 'arches'),
('host_config.capacity', 'capacity'),
('scheduler_host_data.data', 'data'),
)
fields, aliases = zip(*fields)
@ -547,7 +550,8 @@ class TaskScheduler(object):
'host_config.active IS TRUE',
],
joins=[
'host_config ON host.id = host_config.host_id'
'LEFT JOIN host_config ON host.id = host_config.host_id',
'LEFT JOIN scheduler_host_data ON host.id = scheduler_host_data.host_id',
]
)