Skip to content

Commit

Permalink
Fix worker_count_max assigment (OasisLMF#918)
Browse files Browse the repository at this point in the history
  • Loading branch information
sambles authored Nov 2, 2023
1 parent b29f2e0 commit 890cd0e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions kubernetes/worker-controller/src/autoscaler_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def get_desired_worker_count(autoscaling_setting: dict, model_state: ModelState)

strategy = autoscaling_setting.get('scaling_strategy')
worker_count_min = int(autoscaling_setting.get('worker_count_min'))
worker_count_max = int(get_req_setting(autoscaling_setting, 'worker_count_max'))

if strategy:

if strategy == 'FIXED_WORKERS':
count = int(get_req_setting(autoscaling_setting, 'worker_count_fixed'))
return max(
Expand All @@ -30,7 +30,6 @@ def get_desired_worker_count(autoscaling_setting: dict, model_state: ModelState)
)

elif strategy == 'QUEUE_LOAD':
worker_count_max = get_req_setting(autoscaling_setting, 'worker_count_max')
analyses = model_state['analyses']
return max(
min(analyses, worker_count_max),
Expand All @@ -40,7 +39,6 @@ def get_desired_worker_count(autoscaling_setting: dict, model_state: ModelState)
elif strategy == 'DYNAMIC_TASKS':

chunks_per_worker = autoscaling_setting.get('chunks_per_worker')
worker_count_max = int(get_req_setting(autoscaling_setting, 'worker_count_max'))

workers = math.ceil(int(model_state.get('tasks', 0)) / int(chunks_per_worker))
return max(
Expand Down

0 comments on commit 890cd0e

Please sign in to comment.