SPARK-2134: Report metrics before application finishes