remove duplicated code in DAGScheduler.scala