aboutsummaryrefslogtreecommitdiff
path: root/mllib
diff options
context:
space:
mode:
authorx1- <viva008@gmail.com>2015-02-05 15:02:04 -0800
committerXiangrui Meng <meng@databricks.com>2015-02-05 15:02:04 -0800
commit62371adaa5b9251579db7300504506975689610c (patch)
tree04340653677240f5a1e132df8fcf23793020fd91 /mllib
parent4d8d070c4f9f8211afb95d29036eb5e41796dcf2 (diff)
downloadspark-62371adaa5b9251579db7300504506975689610c.tar.gz
spark-62371adaa5b9251579db7300504506975689610c.tar.bz2
spark-62371adaa5b9251579db7300504506975689610c.zip
[SPARK-5460][MLlib] Wrapped `Try` around `deleteAllCheckpoints` - RandomForest.
Because `deleteAllCheckpoints` has IOException potential. fix issue. Author: x1- <viva008@gmail.com> Closes #4347 from x1-/SPARK-5460 and squashes the following commits: 7a3d8de [x1-] change `Try()` to `try catch { case ... }` ar RandomForest. 3a52745 [x1-] modified typo. 'faild' -> 'failed' and remove disused '-'. 1572576 [x1-] Wrapped `Try` around `deleteAllCheckpoints` - RandomForest.
Diffstat (limited to 'mllib')
-rw-r--r--mllib/src/main/scala/org/apache/spark/mllib/tree/RandomForest.scala9
1 files changed, 8 insertions, 1 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/tree/RandomForest.scala b/mllib/src/main/scala/org/apache/spark/mllib/tree/RandomForest.scala
index 482dd4b272..45b0154c5e 100644
--- a/mllib/src/main/scala/org/apache/spark/mllib/tree/RandomForest.scala
+++ b/mllib/src/main/scala/org/apache/spark/mllib/tree/RandomForest.scala
@@ -17,6 +17,8 @@
package org.apache.spark.mllib.tree
+import java.io.IOException
+
import scala.collection.mutable
import scala.collection.JavaConverters._
@@ -244,7 +246,12 @@ private class RandomForest (
// Delete any remaining checkpoints used for node Id cache.
if (nodeIdCache.nonEmpty) {
- nodeIdCache.get.deleteAllCheckpoints()
+ try {
+ nodeIdCache.get.deleteAllCheckpoints()
+ } catch {
+ case e:IOException =>
+ logWarning(s"delete all chackpoints failed. Error reason: ${e.getMessage}")
+ }
}
val trees = topNodes.map(topNode => new DecisionTreeModel(topNode, strategy.algo))