Github user srowen commented on a diff in the pull request: https://github.com/apache/spark/pull/12693#discussion_r61870506 --- Diff: core/src/test/scala/org/apache/spark/scheduler/EventLoggingListenerSuite.scala --- @@ -202,33 +202,37 @@ class EventLoggingListenerSuite extends SparkFunSuite with LocalSparkContext wit // Make sure expected events exist in the log file. val logData = EventLoggingListener.openEventLog(new Path(eventLogger.logPath), fileSystem) - val logStart = SparkListenerLogStart(SPARK_VERSION) - val lines = readLines(logData) - val eventSet = mutable.Set( - SparkListenerApplicationStart, - SparkListenerBlockManagerAdded, - SparkListenerExecutorAdded, - SparkListenerEnvironmentUpdate, - SparkListenerJobStart, - SparkListenerJobEnd, - SparkListenerStageSubmitted, - SparkListenerStageCompleted, - SparkListenerTaskStart, - SparkListenerTaskEnd, - SparkListenerApplicationEnd).map(Utils.getFormattedClassName) - lines.foreach { line => - eventSet.foreach { event => - if (line.contains(event)) { - val parsedEvent = JsonProtocol.sparkEventFromJson(parse(line)) - val eventType = Utils.getFormattedClassName(parsedEvent) - if (eventType == event) { - eventSet.remove(event) + try { + val logStart = SparkListenerLogStart(SPARK_VERSION) + val lines = readLines(logData) --- End diff -- Here, I think readLines is the only thing that reads logData? after it's done you could close the stream. Maybe that's tidier than wrapping so much in the try-finally block.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org