Skip to content

Commit f8d3ddf

Browse files
committed
Name some constants
1 parent b49c69d commit f8d3ddf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

deployer/commands/generate/resource_allocation/generate_choices.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ def proportional_memory_strategy(
5151
# In addition, we provide some wiggle room to account for additional daemonset requests or other
5252
# issues that may pop up due to changes outside our control (like k8s upgrades). This is either
5353
# 2% of the available capacity, or 2GB / 1 CPU (whichever is smaller)
54+
WIGGLE_PERCENTAGE = 0.02
5455
mem_overhead_wiggle = min(
55-
nodeinfo["available"]["memory"] * 0.02, 2 * 1024 * 1024 * 1024
56+
nodeinfo["available"]["memory"] * WIGGLE_PERCENTAGE, 2 * 1024 * 1024 * 1024
5657
)
57-
cpu_overhead_wiggle = min(nodeinfo["available"]["cpu"] * 0.02, 1)
58+
cpu_overhead_wiggle = min(nodeinfo["available"]["cpu"] * WIGGLE_PERCENTAGE, 1)
5859

5960
available_node_mem = nodeinfo["available"]["memory"] - mem_overhead_wiggle
6061
available_node_cpu = nodeinfo["available"]["cpu"] - cpu_overhead_wiggle

0 commit comments

Comments
 (0)