move scheduling code in the scheduler

Signed-off-by: Sébastien Boisvert <boisvert@anl.gov>