[Scheduler] Refactored to comply with the new generated API.