XD-DENG commented on a change in pull request #4304: [AIRFLOW-3500] Make task
duration display user friendly
URL: https://github.com/apache/incubator-airflow/pull/4304#discussion_r240627965
##########
File path: airflow/www/templates/airflow/graph.html
##########
@@ -282,13 +282,21 @@
tt += "Operator: " + task.task_type + "<br>";
tt += "Started: " + ti.start_date + "<br>";
tt += "Ended: " + ti.end_date + "<br>";
- tt += "Duration: " + ti.duration + "<br>";
+ tt += "Duration: " + secondsToString(ti.duration) + "<br>";
tt += "State: " + ti.state + "<br>";
return tt;
});
});
}
+ function secondsToString(seconds) {
+ var numdays = Math.floor((seconds % 31536000) / 86400);
+ var numhours = Math.floor(((seconds % 31536000) % 86400) / 3600);
+ var numminutes = Math.floor((((seconds % 31536000) % 86400) % 3600) /
60);
+ var numseconds = Math.floor((((seconds % 31536000) % 86400) % 3600) %
60);
+ return (numdays > 0 ? numdays + " days " : "") + (numhours > 0 ?
numhours + " hours " : "") + (numminutes > 0 ? numminutes + " minutes " : "") +
(numseconds > 0 ? numseconds + " seconds" : "");
Review comment:
<img width="236" alt="screen shot 2018-12-11 at 10 19 51 pm"
src="https://user-images.githubusercontent.com/11539188/49806517-e98a2f00-fd92-11e8-9ddc-196543b74929.png">
While it should be "1 minute 40 seconds" and "1 minute 1 second" separately.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services