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

Does it make sense to just call markStageAsFinished here (instead of the two lines above)?  I just wonder if doing that will help avoid future bugs along this code path.