Github user felixcheung commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15125#discussion_r101687075
  
    --- Diff: graphx/src/main/scala/org/apache/spark/graphx/Pregel.scala ---
    @@ -122,27 +126,37 @@ object Pregel extends Logging {
         require(maxIterations > 0, s"Maximum number of iterations must be 
greater than 0," +
           s" but got ${maxIterations}")
     
    -    var g = graph.mapVertices((vid, vdata) => vprog(vid, vdata, 
initialMsg)).cache()
    +    var g = graph.mapVertices((vid, vdata) => vprog(vid, vdata, 
initialMsg))
    +    val graphCheckpointer = new PeriodicGraphCheckpointer[VD, ED](
    +      checkpointInterval, graph.vertices.sparkContext)
    +    graphCheckpointer.update(g)
    +
         // compute the messages
         var messages = GraphXUtils.mapReduceTriplets(g, sendMsg, mergeMsg)
    +    val messageCheckpointer = new PeriodicRDDCheckpointer[(VertexId, A)](
    +      checkpointInterval, graph.vertices.sparkContext)
    +    messageCheckpointer.update(messages.asInstanceOf[RDD[(VertexId, A)]])
         var activeMessages = messages.count()
    +
         // Loop
         var prevG: Graph[VD, ED] = null
         var i = 0
         while (activeMessages > 0 && i < maxIterations) {
           // Receive the messages and update the vertices.
           prevG = g
    -      g = g.joinVertices(messages)(vprog).cache()
    +      g = g.joinVertices(messages)(vprog)
    +      graphCheckpointer.update(g)
     
           val oldMessages = messages
           // Send new messages, skipping edges where neither side received a 
message. We must cache
           // messages so it can be materialized on the next line, allowing us 
to uncache the previous
           // iteration.
           messages = GraphXUtils.mapReduceTriplets(
    -        g, sendMsg, mergeMsg, Some((oldMessages, activeDirection))).cache()
    +        g, sendMsg, mergeMsg, Some((oldMessages, activeDirection)))
           // The call to count() materializes `messages` and the vertices of 
`g`. This hides oldMessages
    --- End diff --
    
    should the comment here be updated?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to