From 2eed96f48bdc46a538e16403b8a2c41eef19fa57 Mon Sep 17 00:00:00 2001
From: chenjuanni
Date: Fri, 18 Oct 2019 15:54:16 +0800
Subject: [PATCH] YARN-9913. In YARN ui2 attempt container tab, The Container's
ElapsedTime of running Application is incorrect when the browser and the
yarn server are in different timezons.
---
.../src/main/webapp/app/components/timeline-view.js | 2 +-
.../src/main/webapp/app/models/yarn-container.js | 13 +++++--------
.../app/templates/components/container-table.hbs | 2 +-
3 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js
index 031dd41be93..4f0af8dbce3 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/timeline-view.js
@@ -455,7 +455,7 @@ export default Ember.Component.extend({
}, {
id: 'elapsedTime',
headerTitle: 'Elapsed Time',
- contentPath: 'elapsedTime'
+ contentPath: 'formattedElapsedTime'
}, {
id: 'priority',
headerTitle: 'Priority',
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js
index 6a33e9a2fed..649970eea33 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/yarn-container.js
@@ -26,6 +26,7 @@ export default DS.Model.extend({
priority: DS.attr('number'),
startedTime: DS.attr('number'),
finishedTime: DS.attr('number'),
+ elapsedTime: DS.attr('number'),
logUrl: DS.attr('string'),
containerExitStatus: DS.attr('number'),
containerState: DS.attr('string'),
@@ -49,18 +50,14 @@ export default DS.Model.extend({
return this.get("finishedTime");
}.property("finishedTime"),
- elapsedTime: function() {
- var elapsedMs = this.get("finishedTs") - this.get("startTs");
- if (elapsedMs <= 0) {
- elapsedMs = Date.now() - this.get("startTs");
- }
- return Converter.msToElapsedTimeUnit(elapsedMs);
- }.property(),
+ formattedElapsedTime: function() {
+ return Converter.msToElapsedTimeUnit(this.get("elapsedTime"));
+ }.property("elapsedTime"),
tooltipLabel: function() {
return "Id:" + this.get("id") +
"
ElapsedTime:" +
- String(this.get("elapsedTime")) + "
";
+ String(this.get("formattedElapsedTime")) + "
";
}.property(),
masterNodeURL: function() {
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs
index 25d57c5f02a..a57653ad501 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/components/container-table.hbs
@@ -30,7 +30,7 @@
{{/if}}
Elapsed Time |
- {{container.elapsedTime}} |
+ {{container.formattedElapsedTime}} |
Priority |