[SPARK-2298] Encode stage attempt in SparkListener & UI.

This turned out to be much tricker than I thought. It is still work in progress, since failed stages don't get reported properly yet. Also probably fails the JSON protocol test since I didn't update the protocol.



why do you need to index this by attempt + stageID? As above, isn't only one attempt active at once?