[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.



would be good to add a backwards compatibility test for this, as we did for similar things