From 8b554bd3ca9626e1fc14526711cd8417c7890b69 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Mon, 4 Mar 2024 15:45:02 +0100 Subject: [PATCH] Use also builder's maxjobs setting in scheduler Related: https://pagure.io/koji/issue/4038 --- kojihub/scheduler.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kojihub/scheduler.py b/kojihub/scheduler.py index b35d4d60..f3c26e0b 100644 --- a/kojihub/scheduler.py +++ b/kojihub/scheduler.py @@ -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', ] )