Github user vanzin commented on the issue:

    https://github.com/apache/spark/pull/19981
  
    It's less about cleanliness and more about discoverability IMO. Answer the 
question quickly: where is the SQL UI initialized?
    
    - my code: in the AppStatePlugin implementation
    - your code: it depends. And the two pieces of code don't even live in the 
same file or share any code.
    
    Again, I'll make the same suggestion as before: if you move the SQL tab 
visibility calculation to a new method in the SQL tab itself (and add a filter 
in `WebUI.getTabs` to only show visible tabs), the code will be simpler than 
either your or my version, and the user-visible behavior will remain the same.
    
    This would be the plugin code for both live and SHS:
    
    ```
      override def setupListeners(
          conf: SparkConf,
          store: ElementTrackingStore,
          addListenerFn: SparkListener => Unit,
          live: Boolean): Unit = {
        addListenerFn(new SQLAppStatusListener(conf, store, live, None))
      }
    
      override def setupUI(ui: SparkUI): Unit = {
        val listener = ui.sc.map { /* call LiveListenerBus.findListenersByClass 
*/ }
        new SQLTab(new SQLAppStatusStore(kvstore, Some(listener)), ui)
      }
    ```
    
    Plus you can delete a bunch of code from `SQLAppStatusListener`.


---

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

Reply via email to