spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srowen <...@git.apache.org>
Subject [GitHub] spark pull request #14737: [SPARK-17171][WEB UI] DAG will list all partition...
Date Fri, 09 Sep 2016 12:35:02 GMT
Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14737#discussion_r78171991
  
    --- Diff: core/src/main/scala/org/apache/spark/ui/scope/RDDOperationGraph.scala ---
    @@ -119,18 +119,43 @@ private[ui] object RDDOperationGraph extends Logging {
           { if (stage.attemptId == 0) "" else s" (attempt ${stage.attemptId})" }
         val rootCluster = new RDDOperationCluster(stageClusterId, stageClusterName)
     
    +    var rootNodeCount = 0
    +    val addRDDIds = new mutable.HashSet[Int]()
    +    val dropRDDIds = new mutable.HashSet[Int]()
    +
    +    def isAllowed(rdd: RDDInfo): Boolean = {
    +      val parentIds = rdd.parentIds
    +      if (parentIds.size == 0) {
    +        rootNodeCount < retainedNodes
    +      } else {
    +        parentIds.exists(id => addRDDIds.contains(id) || !dropRDDIds.contains(id))
    +      }
    +    }
    +
         // Find nodes, edges, and operation scopes that belong to this stage
    -    stage.rddInfos.foreach { rdd =>
    -      edges ++= rdd.parentIds.map { parentId => RDDOperationEdge(parentId, rdd.id)
}
    +    stage.rddInfos.sortBy(_.id).foreach { rdd =>
    +      val keepNode = isAllowed(rdd)
    +      if (keepNode) {
    +        addRDDIds.add(rdd.id)
    --- End diff --
    
    Is += more idiomatic?
    Can you also use `stage.rddInfos.sortBy(_.id).partition(isAllowed)` to build the added/dropped
ID sets directly? and then iterate over the added ones?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message