Skip to content
Snippets Groups Projects
Commit 729277eb authored by Ankur Dave's avatar Ankur Dave
Browse files

Undo 8b6b8ac8

Getting unpersist right in GraphLab is tricky.
parent 4cc55090
No related branches found
No related tags found
No related merge requests found
...@@ -110,25 +110,21 @@ object GraphLab extends Logging { ...@@ -110,25 +110,21 @@ object GraphLab extends Logging {
activeGraph.aggregateNeighbors(gather, mergeFunc, gatherDirection) activeGraph.aggregateNeighbors(gather, mergeFunc, gatherDirection)
// Apply // Apply
val applied = activeGraph.outerJoinVertices(gathered)(apply) val applied = activeGraph.outerJoinVertices(gathered)(apply).cache()
// Scatter is basically a gather in the opposite direction so we reverse the edge direction // Scatter is basically a gather in the opposite direction so we reverse the edge direction
val scattered: RDD[(VertexID, Boolean)] = val scattered: RDD[(VertexID, Boolean)] =
applied.aggregateNeighbors(scatter, _ || _, scatterDirection.reverse) applied.aggregateNeighbors(scatter, _ || _, scatterDirection.reverse)
prevActiveGraph = activeGraph prevActiveGraph = activeGraph
activeGraph = activeGraph.outerJoinVertices(scattered)(applyActive).cache() activeGraph = applied.outerJoinVertices(scattered)(applyActive).cache()
// Calculate the number of active vertices. The call to reduce() materializes the vertices of // Calculate the number of active vertices.
// `activeGraph`, hiding the vertices of `prevActiveGraph`.
numActive = activeGraph.vertices.map{ numActive = activeGraph.vertices.map{
case (vid, data) => if (data._1) 1 else 0 case (vid, data) => if (data._1) 1 else 0
}.reduce(_ + _) }.reduce(_ + _)
logInfo("Number active vertices: " + numActive) logInfo("Number active vertices: " + numActive)
// Unpersist the RDDs hidden by newly-materialized RDDs
prevActiveGraph.unpersistVertices(blocking=false)
i += 1 i += 1
} }
......
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