Add `hostname` support for `GROUP_BY` constraint
Fix performance issue with `GROUP_BY` constraint

Assume there are three hosts. Host1 has 2 tasks, while host2 and host3
both have 1 task. We should assign tasks to either host2 or host3, but
in the original implemetation, it waits for only one of the two hosts.

This commit also simplified the implementation, all tests passed.
Merge pull request #720 from iven/master

Add `hostname` support for `GROUP_BY` constraint