pkg/schedutil: Add package schedutil with some helper functions

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
all: Change host list from a map to a slice

This makes it easier to sort and pick random hosts, which is the
typical use case for this response.

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
controller/scheduler: Fix nil pointer dereference in log message

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
controller: Fix bug in jobs test

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
controller/scheduler: Fallback sort hosts by total number of jobs

If the number of jobs of the same type is the same, sort by the total
number of jobs.

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
Merge pull request #639 from flynn/improve-scheduling

Improve scheduling