From 8f35f4a93ae70baf3127614aa8d20ffbbd70c84c Mon Sep 17 00:00:00 2001 From: Nicolo Magini Date: Thu, 22 Oct 2020 17:03:01 +0200 Subject: [PATCH] Fix for https://github.com/HSF/harvester/issues/30 - respect job_type in RT limits --- pandaharvester/harvesterbody/worker_adjuster.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandaharvester/harvesterbody/worker_adjuster.py b/pandaharvester/harvesterbody/worker_adjuster.py index bc27a116..1cf9dcef 100644 --- a/pandaharvester/harvesterbody/worker_adjuster.py +++ b/pandaharvester/harvesterbody/worker_adjuster.py @@ -215,11 +215,11 @@ def define_num_workers(self, static_num_workers, site_name): simple_rt_nw_list = [] for job_type in _d: # jt: job type for resource_type in _d[job_type]: # rt: resource type - simple_rt_nw_list.append([resource_type, _d[job_type][resource_type].get('nNewWorkers', 0), 0]) + simple_rt_nw_list.append([(resource_type, job_type), _d[job_type][resource_type].get('nNewWorkers', 0), 0]) _countdown = n_new_workers_max_agg for _rt_list in simple_rt_nw_list: - resource_type, n_new_workers_orig, _r = _rt_list + (resource_type, job_type), n_new_workers_orig, _r = _rt_list n_new_workers, remainder = divmod(n_new_workers_orig * n_new_workers_max_agg, total_new_workers_rts) dyn_num_workers[queue_name][job_type].setdefault(resource_type, @@ -230,7 +230,7 @@ def define_num_workers(self, static_num_workers, site_name): _countdown -= n_new_workers _s_list = sorted(simple_rt_nw_list, key=(lambda x: x[1])) sorted_rt_nw_list = sorted(_s_list, key=(lambda x: x[2]), reverse=True) - for resource_type, n_new_workers_orig, remainder in sorted_rt_nw_list: + for (resource_type, job_type), n_new_workers_orig, remainder in sorted_rt_nw_list: if _countdown <= 0: break dyn_num_workers[queue_name][job_type][resource_type]['nNewWorkers'] += 1