Skip to content
Snippets Groups Projects
Commit 62371ada authored by x1-'s avatar x1- Committed by Xiangrui Meng
Browse files

[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.
parent 4d8d070c
No related branches found
No related tags found
No related merge requests found
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment