Move this into a method of dagScheduler too