[SPARK-4723] [CORE] To abort the stages which have attempted some times

For some reason, some stages may attempt many times. A threshold could be added and the stages which have attempted more than the threshold could be aborted.