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

    https://github.com/apache/spark/pull/6672#discussion_r33782490
  
    --- Diff: 
core/src/main/scala/org/apache/spark/storage/BlockStatusListener.scala ---
    @@ -0,0 +1,130 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.storage
    +
    +import scala.collection.mutable
    +
    +import org.apache.spark.scheduler._
    +
    +private[spark] case class BlockUIData(
    +    blockId: BlockId,
    +    storageLevel: StorageLevel,
    +    memSize: Long,
    +    diskSize: Long,
    +    externalBlockStoreSize: Long,
    +    locations: Set[String])
    +
    +private[spark] class BlockStatusListener extends SparkListener {
    +
    +  private val blockManagers = new mutable.HashMap[BlockManagerId, 
mutable.HashSet[BlockId]]
    +  private val blocks = new mutable.HashMap[BlockId, BlockUIData]
    +
    +  override def onBlockUpdated(blockUpdated: SparkListenerBlockUpdated): 
Unit = {
    +    val blockId = blockUpdated.blockUpdatedInfo.blockId
    +    if (!blockId.isInstanceOf[StreamBlockId]) {
    +      // Now we only monitor StreamBlocks
    +      return
    +    }
    +    val blockManagerId = blockUpdated.blockUpdatedInfo.blockManagerId
    +    val storageLevel = blockUpdated.blockUpdatedInfo.storageLevel
    +    val memSize = blockUpdated.blockUpdatedInfo.memSize
    +    val diskSize = blockUpdated.blockUpdatedInfo.diskSize
    +    val externalBlockStoreSize = 
blockUpdated.blockUpdatedInfo.externalBlockStoreSize
    +
    +    synchronized {
    +      // Drop the update info if the block manager is not registered
    +      blockManagers.get(blockManagerId).foreach { blocksInBlockManager =>
    +        if (storageLevel.isValid) {
    +          blocksInBlockManager.add(blockId)
    +          val location = blockManagerId.hostPort
    +          val newLocations =
    +            blocks.get(blockId).map(_.locations).getOrElse(Set.empty) + 
location
    +          val newStorageLevel = StorageLevel(
    +            useDisk = diskSize > 0,
    +            useMemory = memSize > 0,
    +            useOffHeap = externalBlockStoreSize > 0,
    --- End diff --
    
    How about displaying like this:
    ![screen shot 2015-07-02 at 10 18 44 
pm](https://cloud.githubusercontent.com/assets/1000778/8479165/6ccb98d8-2108-11e5-831b-2ba273fcafaf.png)
    
    But it does not support sorting. If I click to sort some column, it will 
become like this:
    ![screen shot 2015-07-02 at 10 18 52 
pm](https://cloud.githubusercontent.com/assets/1000778/8479175/82aa5630-2108-11e5-92b2-d83a4b557fc4.png)
    
    But I think the sorting feature is very important for this table, so I 
don't want to disable it. People usually want to find the biggest block.
    
    Thoughts?



---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to