Skip to content

Commit

Permalink
[SPARK-49445][UI] Support show tooltip in the progress bar of UI
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?
This PR aims to support show tooltip in the progress bar of UI.

### Why are the changes needed?
Currently, too much content has been added to the progress bar content in the UI, but the width of the progress bar is limited and it cannot display so much content.

<img width="666" alt="image" src="https://github.com/user-attachments/assets/02b13049-1d7b-43c2-93e1-72e61874b639">

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
local test

<img width="496" alt="image" src="https://github.com/user-attachments/assets/06df9d10-6ff3-4b40-865a-e826af2249f9">

### Was this patch authored or co-authored using generative AI tooling?
No

Closes #47908 from cxzl25/SPARK-49445.

Lead-authored-by: sychen <[email protected]>
Co-authored-by: Kent Yao <[email protected]>
Signed-off-by: Kent Yao <[email protected]>
  • Loading branch information
cxzl25 and yaooqinn committed Sep 4, 2024
1 parent 3e22c47 commit 4a79e73
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions core/src/main/scala/org/apache/spark/ui/UIUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -449,16 +449,24 @@ private[spark] object UIUtils extends Logging {
val startRatio = if (total == 0) 0.0 else (boundedStarted.toDouble / total) * 100
val startWidth = "width: %s%%".format(startRatio)

val killTaskReasonText = reasonToNumKilled.toSeq.sortBy(-_._2).map {
case (reason, count) => s" ($count killed: $reason)"
}.mkString
val progressTitle = s"$completed/$total" + {
if (started > 0) s" ($started running)" else ""
} + {
if (failed > 0) s" ($failed failed)" else ""
} + {
if (skipped > 0) s" ($skipped skipped)" else ""
} + killTaskReasonText

<div class="progress">
<span style="text-align:center; position:absolute; width:100%;">
<span style="text-align:center; position:absolute; width:100%;" title={progressTitle}>
{completed}/{total}
{ if (failed == 0 && skipped == 0 && started > 0) s"($started running)" }
{ if (failed > 0) s"($failed failed)" }
{ if (skipped > 0) s"($skipped skipped)" }
{ reasonToNumKilled.toSeq.sortBy(-_._2).map {
case (reason, count) => s"($count killed: $reason)"
}
}
{ killTaskReasonText }
</span>
<div class="progress-bar progress-completed" style={completeWidth}></div>
<div class="progress-bar progress-started" style={startWidth}></div>
Expand Down

0 comments on commit 4a79e73

Please sign in to comment.