From e98eb2146f1363956bfc3e5adcc11c246182d617 Mon Sep 17 00:00:00 2001 From: Alex Bozarth Date: Fri, 19 Aug 2016 10:04:20 -0500 Subject: [SPARK-16673][WEB UI] New Executor Page removed conditional for Logs and Thread Dump columns ## What changes were proposed in this pull request? When #13670 switched `ExecutorsPage` to use JQuery DataTables it incidentally removed the conditional for the Logs and Thread Dump columns. I reimplemented the conditional display of the Logs and Thread dump columns as it was before the switch. ## How was this patch tested? Manually tested and dev/run-tests ![both](https://cloud.githubusercontent.com/assets/13952758/17186879/da8dd1a8-53eb-11e6-8b0c-d0ff0156a9a7.png) ![dump](https://cloud.githubusercontent.com/assets/13952758/17186881/dab08a04-53eb-11e6-8b1c-50ffd0bf2ae8.png) ![logs](https://cloud.githubusercontent.com/assets/13952758/17186880/dab04d00-53eb-11e6-8754-68dd64d6d9f4.png) Author: Alex Bozarth Closes #14382 from ajbozarth/spark16673. --- .../org/apache/spark/ui/static/executorspage.js | 38 ++++++++++++++++++---- .../org/apache/spark/ui/exec/ExecutorsPage.scala | 7 ++-- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/core/src/main/resources/org/apache/spark/ui/static/executorspage.js b/core/src/main/resources/org/apache/spark/ui/static/executorspage.js index b2b2363d3a..1df67337ea 100644 --- a/core/src/main/resources/org/apache/spark/ui/static/executorspage.js +++ b/core/src/main/resources/org/apache/spark/ui/static/executorspage.js @@ -15,6 +15,16 @@ * limitations under the License. */ +var threadDumpEnabled = false; + +function setThreadDumpEnabled(val) { + threadDumpEnabled = val; +} + +function getThreadDumpEnabled() { + return threadDumpEnabled; +} + function formatStatus(status, type) { if (type !== 'display') return status; if (status) { @@ -116,6 +126,12 @@ function formatLogsCells(execLogs, type) { return result; } +function logsExist(execs) { + return execs.some(function(exec) { + return !($.isEmptyObject(exec["executorLogs"])); + }); +} + // Determine Color Opacity from 0.5-1 // activeTasks range from 0 to maxTasks function activeTasksAlpha(activeTasks, maxTasks) { @@ -143,18 +159,16 @@ function totalDurationAlpha(totalGCTime, totalDuration) { (Math.min(totalGCTime / totalDuration + 0.5, 1)) : 1; } +// When GCTimePercent is edited change ToolTips.TASK_TIME to match +var GCTimePercent = 0.1; + function totalDurationStyle(totalGCTime, totalDuration) { // Red if GC time over GCTimePercent of total time - // When GCTimePercent is edited change ToolTips.TASK_TIME to match - var GCTimePercent = 0.1; return (totalGCTime > GCTimePercent * totalDuration) ? ("hsla(0, 100%, 50%, " + totalDurationAlpha(totalGCTime, totalDuration) + ")") : ""; } function totalDurationColor(totalGCTime, totalDuration) { - // Red if GC time over GCTimePercent of total time - // When GCTimePercent is edited change ToolTips.TASK_TIME to match - var GCTimePercent = 0.1; return (totalGCTime > GCTimePercent * totalDuration) ? "white" : "black"; } @@ -392,8 +406,18 @@ $(document).ready(function () { {data: 'executorLogs', render: formatLogsCells}, { data: 'id', render: function (data, type) { - return type === 'display' ? ("Thread Dump" ) : data; + return type === 'display' ? ("Thread Dump" ) : data; + } } + ], + "columnDefs": [ + { + "targets": [ 15 ], + "visible": logsExist(response) + }, + { + "targets": [ 16 ], + "visible": getThreadDumpEnabled() } ], "order": [[0, "asc"]] @@ -458,7 +482,7 @@ $(document).ready(function () { "paging": false, "searching": false, "info": false - + }; $(sumSelector).DataTable(sumConf); diff --git a/core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala b/core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala index 287390b87b..982e8915a8 100644 --- a/core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala +++ b/core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala @@ -50,16 +50,15 @@ private[ui] class ExecutorsPage( threadDumpEnabled: Boolean) extends WebUIPage("") { private val listener = parent.listener - // When GCTimePercent is edited change ToolTips.TASK_TIME to match - private val GCTimePercent = 0.1 def render(request: HttpServletRequest): Seq[Node] = { val content =
{ -
++ +
++ ++ - + ++ + }
; -- cgit v1.2.3