You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by tg...@apache.org on 2020/06/30 13:58:33 UTC
[spark] branch branch-3.0 updated: [SPARK-32068][WEBUI] Correct
task lauchtime show issue due to timezone in stage tab
This is an automated email from the ASF dual-hosted git repository.
tgraves pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 7d1b6b1 [SPARK-32068][WEBUI] Correct task lauchtime show issue due to timezone in stage tab
7d1b6b1 is described below
commit 7d1b6b148bd6dc84b214e471707e20569258a3d7
Author: TJX2014 <xi...@gmail.com>
AuthorDate: Tue Jun 30 08:56:59 2020 -0500
[SPARK-32068][WEBUI] Correct task lauchtime show issue due to timezone in stage tab
### What changes were proposed in this pull request?
`formatDate` in utils.js `org/apache/spark/ui/static/utils.js` is partly refactored.
### Why are the changes needed?
In branch-2.4,task launch time is returned as html string from driver,
while in branch-3.x,this is returned in JSON Object as`Date`type from `org.apache.spark.status.api.v1.TaskData`
Due to:
LaunchTime from jersey server in spark driver is correct, which will be converted to date string like `2020-06-28T02:57:42.605GMT` in json object, then the formatDate in utils.js treat it as date.split(".")[0].replace("T", " ").
So `2020-06-28T02:57:42.605GMT` will be converted to `2020-06-28 02:57:42`, but correct is `2020-06-28 10:57:42` in GMT+8 timezone.
![选区_071](https://user-images.githubusercontent.com/7149304/85937186-b6d36780-b933-11ea-8382-80a3891f1c2a.png)
![选区_070](https://user-images.githubusercontent.com/7149304/85937190-bcc94880-b933-11ea-8860-2083c97ea269.png)
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Manual test.
Closes #28918 from TJX2014/master-SPARK-32068-ui-task-lauch-time-tz.
Authored-by: TJX2014 <xi...@gmail.com>
Signed-off-by: Thomas Graves <tg...@apache.org>
(cherry picked from commit 165c948e3297fd5ebcee771fcbf7a0c20fccfaae)
Signed-off-by: Thomas Graves <tg...@apache.org>
---
core/src/main/resources/org/apache/spark/ui/static/utils.js | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/core/src/main/resources/org/apache/spark/ui/static/utils.js b/core/src/main/resources/org/apache/spark/ui/static/utils.js
index 6fc34a9..2e46111 100644
--- a/core/src/main/resources/org/apache/spark/ui/static/utils.js
+++ b/core/src/main/resources/org/apache/spark/ui/static/utils.js
@@ -56,13 +56,17 @@ function formatTimeMillis(timeMillis) {
return "-";
} else {
var dt = new Date(timeMillis);
+ return formatDateString(dt);
+ }
+}
+
+function formatDateString(dt) {
return dt.getFullYear() + "-" +
padZeroes(dt.getMonth() + 1) + "-" +
padZeroes(dt.getDate()) + " " +
padZeroes(dt.getHours()) + ":" +
padZeroes(dt.getMinutes()) + ":" +
padZeroes(dt.getSeconds());
- }
}
function getTimeZone() {
@@ -161,7 +165,10 @@ function setDataTableDefaults() {
function formatDate(date) {
if (date <= 0) return "-";
- else return date.split(".")[0].replace("T", " ");
+ else {
+ var dt = new Date(date.replace("GMT", "Z"))
+ return formatDateString(dt);
+ }
}
function createRESTEndPointForExecutorsPage(appId) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org