From 621833ef0ee56b1a5ff4ae03c99555f583205ff6 Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Thu, 14 Jul 2022 15:54:44 -0400 Subject: [PATCH] Add extra workers if computing based on memory Co-authored-by: Elijah DeLee --- awx/main/dispatch/pool.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/awx/main/dispatch/pool.py b/awx/main/dispatch/pool.py index c9a60f2265..ce6c297861 100644 --- a/awx/main/dispatch/pool.py +++ b/awx/main/dispatch/pool.py @@ -341,6 +341,10 @@ class AutoscalePool(WorkerPool): # Get same number as max forks based on memory, this function takes memory as bytes self.max_workers = get_mem_effective_capacity(total_memory_gb * 2**30) + # add magic prime number of extra workers to ensure + # we have a few extra workers to run the heartbeat + self.max_workers += 7 + # max workers can't be less than min_workers self.max_workers = max(self.min_workers, self.max_workers)