You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "LiDongwei (Jira)" <ji...@apache.org> on 2021/04/14 02:19:00 UTC

[jira] [Updated] (SPARK-35053) Spark UI Stages->Tasks should show local launch time

     [ https://issues.apache.org/jira/browse/SPARK-35053?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

LiDongwei updated SPARK-35053:
------------------------------
    Description: 
Hello!

The launch time of the task displayed on the Spark Stage tab is the UTC time zone, which confuses users in non-UTC time zones. After checking some of the code, it seems that it can be solved by modifying the following code.

[File involved |https://github.com/apache/spark/blob/master/core/src/main/resources/org/apache/spark/ui/static/utils.js]

 

Current :
{code:java}
// code placeholder
function formatDate(date) {
  if (date <= 0) return "-";
  else {
     var dt = new Date(date.replace("GMT", "Z"));
     return formatDateString(dt);
  }
}

{code}
Updated (example):
{code:java}
// code placeholder
function formatDate(date) {
    if (date <= 0) {
        return "-";
    }
    else {
        let local = new Date();
        let gmtTime = new Date(date.split(".")[0].replace("T", " "));
        let res = new Date(gmtTime.getTime() - (local.getTimezoneOffset() * 60000)).getTime();
        return formatTimeMillis(res);
    }
}
{code}
 

 

  was:
Hello!

The launch time of the task displayed on the Spark Stage tab is the UTC time zone, which confuses users in non-UTC time zones. After checking some of the code, it seems that it can be solved by modifying the following code.

[File involved |https://github.com/apache/spark/blob/master/core/src/main/resources/org/apache/spark/ui/static/utils.js]

 

Current :
{code:java}
// code placeholder
function formatTimeMillis(timeMillis) {
      
      
          if (timeMillis <= 0) {
      
      
            return "-";
      
      
          } else {
      
      
            var dt = new Date(timeMillis);
      
      
            return formatDateString(dt);
      
      
          }
      
      
        }
{code}
Updated (example):
{code:java}
// code placeholder
function formatDate(date) {
    if (date <= 0) {
        return "-";
    }
    else {
        let local = new Date();
        let gmtTime = new Date(date.split(".")[0].replace("T", " "));
        let res = new Date(gmtTime.getTime() - (local.getTimezoneOffset() * 60000)).getTime();
        return formatTimeMillis(res);
    }
}
{code}
 

 


> Spark UI Stages->Tasks should show local launch time
> ----------------------------------------------------
>
>                 Key: SPARK-35053
>                 URL: https://issues.apache.org/jira/browse/SPARK-35053
>             Project: Spark
>          Issue Type: Bug
>          Components: Web UI
>    Affects Versions: 3.1.1
>            Reporter: LiDongwei
>            Priority: Minor
>
> Hello!
> The launch time of the task displayed on the Spark Stage tab is the UTC time zone, which confuses users in non-UTC time zones. After checking some of the code, it seems that it can be solved by modifying the following code.
> [File involved |https://github.com/apache/spark/blob/master/core/src/main/resources/org/apache/spark/ui/static/utils.js]
>  
> Current :
> {code:java}
> // code placeholder
> function formatDate(date) {
>   if (date <= 0) return "-";
>   else {
>      var dt = new Date(date.replace("GMT", "Z"));
>      return formatDateString(dt);
>   }
> }
> {code}
> Updated (example):
> {code:java}
> // code placeholder
> function formatDate(date) {
>     if (date <= 0) {
>         return "-";
>     }
>     else {
>         let local = new Date();
>         let gmtTime = new Date(date.split(".")[0].replace("T", " "));
>         let res = new Date(gmtTime.getTime() - (local.getTimezoneOffset() * 60000)).getTime();
>         return formatTimeMillis(res);
>     }
> }
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org