zuston commented on code in PR #1410: URL: https://github.com/apache/auron/pull/1410#discussion_r2418374204
########## auron-spark-ui/src/main/scala/org/apache/spark/sql/execution/ui/AuronSQLTab.scala: ########## @@ -0,0 +1,31 @@ +/* + * 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.sql.execution.ui + +import org.apache.spark.internal.Logging +import org.apache.spark.ui.{SparkUI, SparkUITab} + +class AuronSQLTab(val sqlStore: AuronSQLAppStatusStore, sparkUI: SparkUI) + extends SparkUITab(sparkUI, "auron") + with Logging { + + override val name = "AURON SQL / DataFrame" Review Comment: AURON is enough? ########## auron-spark-ui/src/main/scala/org/apache/spark/sql/execution/ui/AuronAllExecutionsPage.scala: ########## @@ -0,0 +1,77 @@ +/* + * 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.sql.execution.ui + +import javax.servlet.http.HttpServletRequest + +import scala.collection.mutable +import scala.xml.{Node, NodeSeq} + +import org.apache.spark.internal.Logging +import org.apache.spark.ui.{UIUtils, WebUIPage} + +private[ui] class AuronAllExecutionsPage(parent: AuronSQLTab) extends WebUIPage("") with Logging { + + private val sqlStore = parent.sqlStore + + override def render(request: HttpServletRequest): Seq[Node] = { + val buildInfo = sqlStore.buildInfo() + + val content = { + val _content = mutable.ListBuffer[Node]() + _content + } + content ++= + <script> + function clickDetail(details) {{ + details.parentNode.querySelector('.stage-details').classList.toggle('collapsed') + }} + </script> + + val infos = + UIUtils.listingTable(propertyHeader, propertyRow, buildInfo.info, fixedWidth = true) + val summary: NodeSeq = + <div> + <div> + <span class="collapse-sql-properties collapse-table" + onClick="collapseTable('collapse-sql-properties', 'sql-properties')"> + <h4> + <span class="collapse-table-arrow arrow-open"></span> + <a>Auron Build Information</a> + </h4> + </span> + <div class="sql-properties collapsible-table"> + {infos} + </div> + </div> + <br/> + </div> + + UIUtils.headerSparkPage(request, "Auron SQL / DataFrame", summary ++ content, parent) Review Comment: `Auron SQL / DataFrame` -> `Auron` is enough? ########## auron-spark-ui/src/main/scala/org/apache/spark/sql/execution/ui/AuronSQLAppStatusListener.scala: ########## @@ -0,0 +1,76 @@ +/* + * 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.sql.execution.ui + +import scala.collection.mutable + +import org.apache.spark.{SparkConf, SparkContext} +import org.apache.spark.internal.Logging +import org.apache.spark.scheduler.{SparkListener, SparkListenerEvent} +import org.apache.spark.sql.internal.StaticSQLConf.UI_RETAINED_EXECUTIONS +import org.apache.spark.status.ElementTrackingStore + +import org.apache.auron.spark.ui.AuronBuildInfoEvent + +class AuronSQLAppStatusListener(conf: SparkConf, kvstore: ElementTrackingStore) + extends SparkListener + with Logging { + private val executionIdToDescription = new mutable.HashMap[Long, String] + + kvstore.addTrigger(classOf[SQLExecutionUIData], conf.get[Int](UI_RETAINED_EXECUTIONS)) { + count => cleanupExecutions(count) + } + + def getAuronBuildInfo(): Long = { + kvstore.count(classOf[AuronBuildInfoUIData]) + } + + private def onAuronBuildInfo(event: AuronBuildInfoEvent): Unit = { + val uiData = new AuronBuildInfoUIData(event.info.toSeq) + kvstore.write(uiData) + } + + private def onSQLExecutionStart(event: SparkListenerSQLExecutionStart): Unit = { + executionIdToDescription.put(event.executionId, event.description) Review Comment: Why we need this? ########## auron-spark-ui/src/main/scala/org/apache/spark/sql/execution/ui/AuronAllExecutionsPage.scala: ########## @@ -0,0 +1,77 @@ +/* + * 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.sql.execution.ui + +import javax.servlet.http.HttpServletRequest + +import scala.collection.mutable +import scala.xml.{Node, NodeSeq} + +import org.apache.spark.internal.Logging +import org.apache.spark.ui.{UIUtils, WebUIPage} + +private[ui] class AuronAllExecutionsPage(parent: AuronSQLTab) extends WebUIPage("") with Logging { + + private val sqlStore = parent.sqlStore + + override def render(request: HttpServletRequest): Seq[Node] = { + val buildInfo = sqlStore.buildInfo() + + val content = { + val _content = mutable.ListBuffer[Node]() + _content + } + content ++= + <script> + function clickDetail(details) {{ Review Comment: do we need this? If setting the class with `collapse` , it looks the operation of collapse will work ########## auron-spark-ui/src/main/scala/org/apache/spark/sql/execution/ui/AuronSQLAppStatusListener.scala: ########## @@ -0,0 +1,76 @@ +/* + * 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.sql.execution.ui + +import scala.collection.mutable + +import org.apache.spark.{SparkConf, SparkContext} +import org.apache.spark.internal.Logging +import org.apache.spark.scheduler.{SparkListener, SparkListenerEvent} +import org.apache.spark.sql.internal.StaticSQLConf.UI_RETAINED_EXECUTIONS +import org.apache.spark.status.ElementTrackingStore + +import org.apache.auron.spark.ui.AuronBuildInfoEvent + +class AuronSQLAppStatusListener(conf: SparkConf, kvstore: ElementTrackingStore) + extends SparkListener + with Logging { + private val executionIdToDescription = new mutable.HashMap[Long, String] + + kvstore.addTrigger(classOf[SQLExecutionUIData], conf.get[Int](UI_RETAINED_EXECUTIONS)) { Review Comment: Is this right? The `SQLExecutionUIData` should not be managed by this calss ########## auron-spark-ui/src/main/scala/org/apache/spark/sql/execution/ui/AuronSQLHistoryServerPlugin.scala: ########## @@ -0,0 +1,40 @@ +/* + * 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.sql.execution.ui + +import org.apache.spark.SparkConf +import org.apache.spark.scheduler.SparkListener +import org.apache.spark.status.{AppHistoryServerPlugin, ElementTrackingStore} +import org.apache.spark.ui.SparkUI + +class AuronSQLHistoryServerPlugin extends AppHistoryServerPlugin { + + override def createListeners( + conf: SparkConf, + store: ElementTrackingStore): Seq[SparkListener] = { + Seq(new AuronSQLAppStatusListener(conf, store)) + } + + override def setupUI(ui: SparkUI): Unit = { + val sqlStatusStore = new AuronSQLAppStatusStore(ui.store.store) + if (sqlStatusStore.buildInfo() != null) { Review Comment: It looks we should check this by the auron UI enable key? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
