浏览代码

changes to worker calculation

Avik Datta 4 年之前
父节点
当前提交
7f5cc1aaef
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      igf_airflow/check_celery_queue.py

+ 3 - 1
igf_airflow/check_celery_queue.py

@@ -60,10 +60,12 @@ def calculate_new_workers(queue_list,active_jobs_dict,max_workers_per_queue=10,m
     if isinstance(queue_list,list) and \
        len(queue_list) > 0 and \
        total_active_jobs < max_total_workers:
-      for entry in queue_list:                         # this list should be unique
+      for entry in queue_list:                                                  # this list should be unique
         for queue_name,waiting_jobs in entry.items():
           if waiting_jobs > max_workers_per_queue:
             waiting_jobs = max_workers_per_queue
+          if int(waiting_jobs/2) > 1:
+            waiting_jobs = int(waiting_jobs/2)                                  #submit half of the workers
           active_job = active_jobs_dict.get(queue_name)
           total_running_for_queue = 0
           active_queued_job = 0