Skip to content

Instantly share code, notes, and snippets.

View erictune's full-sized avatar
😃

Eric Tune erictune

😃
View GitHub Profile
@erictune
erictune / mostallocated.py
Created March 18, 2026 19:09
Show why mostallocated is better because it never reduces future choices.
capacity=8
sizes = [1,2,4,8]
# Look at all "interesting" two node scenarios where there is an incoming pod P.
# Node are called A and B.
# This is a list of (node_a_allocatable, node_b_allocatable, pod_p_limit)
# A is always the less allocated node.
# P is feasible on both A or B. (Ignore scenarios where there is no choice to make.)
# P has a size in `sizes'
scenarios = [(a,b,p) for a in range(9) for b in range(a+1,9) for p in sizes if a+p <= capacity]
# scenarios = [(0, 1, 1), (0, 1, 2), ..., (0, 2, 1), ..., (6, 8, 2), (7, 8, 1)]