WeichenXu123 commented on a change in pull request #32399:
URL: https://github.com/apache/spark/pull/32399#discussion_r633177750



##########
File path: 
mllib/src/main/scala/org/apache/spark/ml/tuning/TrainValidationSplit.scala
##########
@@ -161,11 +174,28 @@ class TrainValidationSplit @Since("1.5.0") 
(@Since("1.5.0") override val uid: St
     }
 
     // Wait for all metrics to be calculated
-    val metrics = metricFutures.map(ThreadUtils.awaitResult(_, Duration.Inf))
-
-    // Unpersist training & validation set once all metrics have been produced
-    trainingDataset.unpersist()
-    validationDataset.unpersist()
+    val metrics = try {
+      metricFutures.map(ThreadUtils.awaitResult(_, Duration.Inf))
+    }
+    catch {
+      case e: Throwable =>
+        subTaskFailed = true
+        try {
+          Thread.sleep(1000)
+          val sparkContext = sparkSession.sparkContext
+          sparkContext.cancelJobGroup(tvsJobGroup)
+        } catch {
+          case _: Throwable => ()

Review comment:
       I think this is a standard way representing return "Unit", 
https://stackoverflow.com/questions/53415664/how-do-i-explicitly-return-unit




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to