Move the if statement into dagScheduler.resubmitFailedStages perhaps since it accesses fields of dagScheduler