Refactor autoscaler inner loop to be more testable
Refactor autoscaler inner loop to be more testable

This may have broken things, but the tests still pass. So if this
turns out to have messed things up, that sort of proves my point.

BD2KGenomics/slugflow,BD2KGenomics/slugflow