This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new a108d29e5a66 [SPARK-52487][UI] Add Stage Submitted Time and Duration 
to StagePage Detail
a108d29e5a66 is described below

commit a108d29e5a66d3ae8556b47d773afc1f4306d804
Author: Kent Yao <[email protected]>
AuthorDate: Mon Jun 16 07:33:48 2025 -0700

    [SPARK-52487][UI] Add Stage Submitted Time and Duration to StagePage Detail
    
    ### What changes were proposed in this pull request?
    
    This PR proposes to add Stage Submitted Time and Duration to the StagePage 
Detail
    
    ### Why are the changes needed?
    
    UX improvements while looking into stage details
    
    ### Does this PR introduce _any_ user-facing change?
    Yes, UI changes
    
    ### How was this patch tested?
    
    build and test locally
    
![image](https://github.com/user-attachments/assets/f704dfbf-813d-46df-ab21-580fcd843ed1)
    
    ### Was this patch authored or co-authored using generative AI tooling?
    no
    
    Closes #51185 from yaooqinn/SPARK-52487.
    
    Authored-by: Kent Yao <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 .../org/apache/spark/ui/jobs/StageDataUtil.scala   | 39 ++++++++++++++++++++++
 .../scala/org/apache/spark/ui/jobs/StagePage.scala |  8 +++++
 2 files changed, 47 insertions(+)

diff --git a/core/src/main/scala/org/apache/spark/ui/jobs/StageDataUtil.scala 
b/core/src/main/scala/org/apache/spark/ui/jobs/StageDataUtil.scala
new file mode 100644
index 000000000000..7757a815da65
--- /dev/null
+++ b/core/src/main/scala/org/apache/spark/ui/jobs/StageDataUtil.scala
@@ -0,0 +1,39 @@
+/*
+ * 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.ui.jobs
+
+import org.apache.spark.status.api.v1.StageData
+import org.apache.spark.ui.UIUtils
+
+object StageDataUtil {
+  def getDuration(stageData: StageData): Option[Long] = {
+    stageData.submissionTime.map { start =>
+      val end = 
stageData.completionTime.map(_.getTime).getOrElse(System.currentTimeMillis())
+      end - start.getTime
+    }
+  }
+
+  def getFormattedDuration(stageData: StageData): String = {
+    val duration = getDuration(stageData)
+    duration.map(d => UIUtils.formatDuration(d)).getOrElse("Unknown")
+  }
+
+  def getFormattedSubmissionTime(stageData: StageData): String = {
+    stageData.submissionTime.map(UIUtils.formatDate).getOrElse("Unknown")
+  }
+}
diff --git a/core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala 
b/core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala
index 257f7b37758a..4fa7c8149690 100644
--- a/core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala
+++ b/core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala
@@ -141,6 +141,14 @@ private[ui] class StagePage(parent: StagesTab, store: 
AppStatusStore) extends We
     val summary =
       <div>
         <ul class="list-unstyled">
+          <li>
+            <Strong>Submitted:</Strong>
+            {StageDataUtil.getFormattedSubmissionTime(stageData)}
+          </li>
+          <li>
+            <strong>Duration</strong>
+            {StageDataUtil.getFormattedDuration(stageData)}
+          </li>
           <li>
             <strong>Resource Profile Id: </strong>
             {stageData.resourceProfileId}


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

Reply via email to