Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

how to read time reported by yarn

Solved Go to solution

how to read time reported by yarn

Master Collaborator

how can I convert this start and finish time to normal date format?

$ yarn application -status application_1517871817099_0015
Application Report :
        Application-Id : application_1517871817099_0015
        Application-Name : distcp
        Application-Type : MAPREDUCE
        Queue : default
        Application Priority : null
        Start-Time : 1517874876754
        Finish-Time : 1517875501288
        Progress : 100%
        State : KILLED
        Final-State : KILLED
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: how to read time reported by yarn

Master Collaborator

ok I found three ways to convert correctly the milliseconds unix time to human readable time format

mysql> select from_unixtime(floor(1517874876754/1000));
+------------------------------------------+
| from_unixtime(floor(1517874876754/1000)) |
+------------------------------------------+
| 2018-02-05 18:54:36                      |
+------------------------------------------+
1 row in set (0.00 sec)

$ awk '{print strftime("%c", ( 1517874876754 + 500 ) / 1000 )}'
Mon 05 Feb 2018 06:54:37 PM EST

$ date -d @$(  echo "(1517874876754+ 500) / 1000" | bc)
Mon Feb  5 18:54:37 EST 2018


2 REPLIES 2

Re: how to read time reported by yarn

Master Collaborator

I found two methods online which gives different results , which one is correct ?

$ date -d @1517874876754
Tue Jul 16 02:12:34 EDT 50069
mysql> select from_unixtime(floor(1517875501288/1000));
+------------------------------------------+
| from_unixtime(floor(1517875501288/1000)) |
+------------------------------------------+
| 2018-02-05 19:05:01                      |
+------------------------------------------+
Highlighted

Re: how to read time reported by yarn

Master Collaborator

ok I found three ways to convert correctly the milliseconds unix time to human readable time format

mysql> select from_unixtime(floor(1517874876754/1000));
+------------------------------------------+
| from_unixtime(floor(1517874876754/1000)) |
+------------------------------------------+
| 2018-02-05 18:54:36                      |
+------------------------------------------+
1 row in set (0.00 sec)

$ awk '{print strftime("%c", ( 1517874876754 + 500 ) / 1000 )}'
Mon 05 Feb 2018 06:54:37 PM EST

$ date -d @$(  echo "(1517874876754+ 500) / 1000" | bc)
Mon Feb  5 18:54:37 EST 2018


Don't have an account?
Coming from Hortonworks? Activate your account here