diff options
author | x1- <viva008@gmail.com> | 2015-02-05 15:02:04 -0800 |
---|---|---|
committer | Xiangrui Meng <meng@databricks.com> | 2015-02-05 15:02:14 -0800 |
commit | 44768f582c29f0bb469eca7aca46364ac5c3a1ec (patch) | |
tree | 04340653677240f5a1e132df8fcf23793020fd91 | |
parent | 55cebcf5b3914c177c92ecfb11b8ebf7c405d74f (diff) | |
download | spark-44768f582c29f0bb469eca7aca46364ac5c3a1ec.tar.gz spark-44768f582c29f0bb469eca7aca46364ac5c3a1ec.tar.bz2 spark-44768f582c29f0bb469eca7aca46364ac5c3a1ec.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.
(cherry picked from commit 62371adaa5b9251579db7300504506975689610c)
Signed-off-by: Xiangrui Meng <meng@databricks.com>
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/mllib/tree/RandomForest.scala | 9 |
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)) |