Uh oh!
There was an error while loading. Please reload this page.
[SPARK-16986][WEB-UI] Converter Started, Completed and Last Updated to client time zone in history page - #19640
[SPARK-16986][WEB-UI] Converter Started, Completed and Last Updated to client time zone in history page#19640wangyum wants to merge 11 commits into
Conversation
srowen
commented
Nov 2, 2017
@wangyum this was a WontFix. See linked JIRAs for some of the discussion and implications. |
wangyum
commented
Nov 2, 2017
srowen
commented
Nov 2, 2017
This is a significant behavior change though. If anything we need to move towards GMT, not towards varying with whatever the server's timezone is. |
SparkQA
commented
Nov 2, 2017
Test build #83326 has finished for PR 19640 at commit
|
SparkQA
commented
Nov 3, 2017
Test build #83383 has finished for PR 19640 at commit
|
wangyum
commented
Nov 3, 2017
retest this please |
SparkQA
commented
Nov 3, 2017
Test build #83385 has finished for PR 19640 at commit
|
wangyum
commented
Nov 3, 2017
@srowen We can configure time zone by |
| ugi.getAuthenticationMethod() == UserGroupInformation.AuthenticationMethod.PROXY | ||
| } | ||
| def getTimeZone: TimeZone = { |
There was a problem hiding this comment.
I would write it like
def timeZone: TimeZone = TimeZone.getTimeZone(sparkConf.get("spark.history.timeZone", "GMT"))
| } | ||
| def getTimeZone: TimeZone = { | ||
| TimeZone.getTimeZone(sparkConf.get("spark.history.timeZone", "GMT")) |
There was a problem hiding this comment.
It's a bit confusing using spark.history.timeZone property in getTimeZone method of SparkHadoopUtil.
jiangxb1987
commented
Nov 3, 2017
cc @ueshin |
| } | ||
| } | ||
| def getTimeZone: TimeZone = { |
There was a problem hiding this comment.
Could you please image that this method will be used outside scope of the current issue?
What's about users who does not have spark history at all?
The name of method, the class and the package does not tell us that this method somehow related ONLY to history server, such API makes me easy to do wrong assumptions.
SparkQA
commented
Nov 6, 2017
Test build #83480 has finished for PR 19640 at commit
|
| } | ||
| def getTimeZone: TimeZone = { | ||
| val sparkConf = new SparkConf(false).loadFromSystemProperties(true) |
There was a problem hiding this comment.
Can we make SparkConf as a input param instead of create a new instance for every function call?
SparkQA
commented
Nov 7, 2017
Test build #83550 has finished for PR 19640 at commit
|
| ugi.getAuthenticationMethod() == UserGroupInformation.AuthenticationMethod.PROXY | ||
| } | ||
| def getHistoryServerTimeZone: String = sparkConf.get("spark.history.timeZone", "GMT") |
There was a problem hiding this comment.
Please add this config to internal/config.
vanzin
commented
Nov 8, 2017
I'm not a fan of this change; this seems like it should be done client-side, so that the browser shows timestamps in its own time zone, and the server should only know about UTC. The API probably should be left alone - especially because with this change it becomes a little confusing, since you have a timestamp in whatever is the configured server tz, and the raw value which is in UTC. |
SparkQA
commented
Nov 8, 2017
Test build #83601 has finished for PR 19640 at commit
|
cloud-fan
commented
Nov 10, 2017
Since a spark cluster may be used by people from different timezones, I think at server side we should just store seconds from unix epoch(time epoch), which is comparable though different timezones. For the REST API, personally I think the server just need to send time epoch, but for ease of use, sending a timestamp string with GMT is acceptable. For the UI part, I think it's more reasonable to interpret the time epoch using browser's local timezone, but we don't need a config. |
wangyum
commented
Nov 11, 2017
@cloud-fan For the UI part, how about this PR: #14577 |
cloud-fan
commented
Nov 11, 2017
I think it makes sense, but the implementation is too hacky. We should extract the time epoch and convert it to timestamp string with local timezone. |
SparkQA
commented
Nov 11, 2017
Test build #83727 has finished for PR 19640 at commit
|
| if (date <= 0) return "-"; | ||
| else return date.split(".")[0].replace("T", " "); | ||
| if (date <= 0) { | ||
| return "-"; |
There was a problem hiding this comment.
just for curious, what does a single - mean here? invalid value?
There was a problem hiding this comment.
Yes, invalid value. Maybe we can remove this.
wangyum
commented
Nov 14, 2017
cloud-fan
commented
Nov 14, 2017
how about BTW the |
wangyum
commented
Nov 14, 2017
It is client local time zone: But the format is |
cloud-fan
commented
Nov 14, 2017
maybe we can move |
wangyum
commented
Nov 14, 2017
cloud-fan
commented
Nov 14, 2017
why it has |
wangyum
commented
Nov 14, 2017
cloud-fan
commented
Nov 14, 2017
sorry, I mean we should follow the format we use in completed, started... |
| .filter(_.startsWith(url)).toList | ||
| // there are atleast some URL links that were generated via javascript, | ||
| // there are at least some URL links that were generated via javascript, |
| } | ||
| function padZeroes(num) { | ||
| return ("0" + num).slice(-2); |
There was a problem hiding this comment.
num.toString().padStart(2, "0") cause org.apache.spark.deploy.history.HistoryServerSuite test failed.
There was a problem hiding this comment.
padStart with poor compatibility:
| Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | 57 | 15 | 48 | No | 44 | 10 |
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/slice
There was a problem hiding this comment.
TagNameQuery("a") gets result from WebBrowser, This browser doesn't support this function.
| return resl; | ||
| } | ||
| function formatDate(date) { |
| } | ||
| function getTimeZone() { | ||
| return new Date().toString().match(/\(([A-Za-z\s].*)\)/)[1]; |
There was a problem hiding this comment.
how about Intl.DateTimeFormat().resolvedOptions().timeZone
There was a problem hiding this comment.
This timeZone seems incorrect. Safari gets Asia/Shanghai, but Chrome gets America/Chicago on the same computer.
How about just include this change to release notes.
There was a problem hiding this comment.
did you have proxy on your chrome? It works fine at my Chrome.
| } | ||
| } | ||
| { |
There was a problem hiding this comment.
any more feedback on the naming?
SparkQA
commented
Nov 14, 2017
Test build #83848 has finished for PR 19640 at commit
|
wangyum
commented
Nov 14, 2017
retest this please. |
SparkQA
commented
Nov 15, 2017
Test build #83868 has finished for PR 19640 at commit
|
| try { | ||
| return Intl.DateTimeFormat().resolvedOptions().timeZone; | ||
| } catch(ex) { | ||
| return new Date().toString().match(/\((.*)\)/)[1]; |
There was a problem hiding this comment.
if you really want to keep this code, please add comment to explain this regex.
| } | ||
| function getTimeZone() { | ||
| try { |
There was a problem hiding this comment.
Some old browser doesn't support this function. so I surround with try catch.
| Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | 24 | 12 | 29 | 11 | 15 | 10 |
| computed timeZone | 35 | 14 | 53 | No | 30 | 10 |
There was a problem hiding this comment.
cc @srowen does Spark have a guarantee about which version of which browser to support?
There was a problem hiding this comment.
Spark does not have a list of supported browsers, from my experience most of us just test new UI changes on whatever browsers we have (In my case the latest Safari, Chrome and Firefox ESR). Though I'd like to think we don't have any IE users, we can't make that assumption while IE 11 is still supported by MS.
SparkQA
commented
Nov 15, 2017
Test build #83900 has finished for PR 19640 at commit
|
SparkQA
commented
Nov 15, 2017
Test build #83902 has finished for PR 19640 at commit
|
ajbozarth
commented
Nov 15, 2017
I'm still not 100% convinced this is the best change, but the implementation LGTM. |
cloud-fan
commented
Nov 15, 2017
It's a pure UI change so no compatibility issues. The new UI LGTM |
vanzin
commented
Dec 12, 2017
JS is not really my thing, but other have reviewed and seem ok. I'm fine with this being done client-side. Merging to master. |



What changes were proposed in this pull request?
This PR is converted the
Started,CompletedandLast Updatedto client local time in the history page.How was this patch tested?
Manual tests for Chrome, Firefox and Safari
Before modifying:
After modifying: