Re: wanna-build / how to sort packages on buildds?
]] Andreas Barth
| Now my question is just: How to do that efficient? I.e. how would such
| a configuration file look like, and how the code to distribute the
| package on the most fitting buildd(s)? (I.e. it's better to waste 5
| out of 6 cores than to not build a package at all, but a package
| needing at least 1g ram can't build on a buildd with only 512mb - but
| no package should starve in the end.)
| Ideas? Suggestions? Code?
Sounds like a variant of the knapsack problem.
I'd suggest something like:
- Have a mapping for buildds from resources to a value (this can just be
a perl hash), this defines cores, amount of memory, etc.
- Each package has a minimum requirement for cpu, memory, etc, stored in a
hash. Store all the packages in a list.
- Sort the list, either according to a score which is a mix of cpu and
memory and whatever other factors you want or first along the cpu
axis, then along the memory axis, etc. I suspect CPU and memory
requirements are correlated, but not perfectly.
- Assign packages to buildds on a first-match basis. That means you get
the hardest packages done first. The match has to make sure the
buildd can actually build the package in question, of course.
Tollef Fog Heen
UNIX is user friendly, it's just picky about who its friends are