hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject hadoop git commit: YARN-5151. [UI2] Support kill application from new YARN UI. Contributed by Gergely Novák.
Date Tue, 08 May 2018 05:05:30 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 08ea90e1e -> 9832265e1


YARN-5151. [UI2] Support kill application from new YARN UI. Contributed by Gergely Novák.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/9832265e
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/9832265e
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/9832265e

Branch: refs/heads/trunk
Commit: 9832265e1deeefaa6d58f9f62052c8ef6a8e82b7
Parents: 08ea90e
Author: Sunil G <sunilg@apache.org>
Authored: Tue May 8 10:35:19 2018 +0530
Committer: Sunil G <sunilg@apache.org>
Committed: Tue May 8 10:35:19 2018 +0530

----------------------------------------------------------------------
 .../src/main/webapp/app/adapters/yarn-app.js    | 13 +++++--
 .../src/main/webapp/app/controllers/yarn-app.js | 35 ++++++++++++++++++
 .../src/main/webapp/app/templates/yarn-app.hbs  | 37 ++++++++++++++++----
 3 files changed, 76 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/9832265e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
index 111e468..d29dff4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/yarn-app.js
@@ -16,9 +16,9 @@
  * limitations under the License.
  */
 
-import AbstractAdapter from './abstract';
+import RESTAbstractAdapter from './restabstract';
 
-export default AbstractAdapter.extend({
+export default RESTAbstractAdapter.extend({
   address: "rmWebAddress",
   restNameSpace: "cluster",
   serverName: "RM",
@@ -38,4 +38,13 @@ export default AbstractAdapter.extend({
   pathForType(/*modelName*/) {
     return 'apps'; // move to some common place, return path by modelname.
   },
+
+  sendKillApplication(id) {
+    var url = this._buildURL();
+    url += '/apps/' + id + '/state';
+    var data = {
+      "state": "KILLED"
+    };
+    return this.ajax(url, "PUT", { data: data });
+  }
 });

http://git-wip-us.apache.org/repos/asf/hadoop/blob/9832265e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.js
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.js
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.js
index d80f172..45201a1 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/yarn-app.js
@@ -81,6 +81,33 @@ export default Ember.Controller.extend({
       });
     },
 
+    showKillApplicationConfirm() {
+      this.set('actionResponse', null);
+      Ember.$("#killApplicationConfirmDialog").modal('show');
+    },
+
+    killApplication() {
+      var self = this;
+      Ember.$("#killApplicationConfirmDialog").modal('hide');
+      const adapter = this.store.adapterFor('yarn-app');
+      self.set('isLoading', true);
+      adapter.sendKillApplication(this.model.app.id).then(function () {
+        self.set('actionResponse', {
+          msg: 'Application killed successfully. Auto refreshing in 5 seconds.',
+          type: 'success'
+        });
+        Ember.run.later(self, function () {
+          this.set('actionResponse', null);
+          this.send("refresh");
+        }, 5000);
+      }, function (err) {
+        let message = err.diagnostics || 'Error: Kill application failed!';
+        self.set('actionResponse', { msg: message, type: 'error' });
+      }).finally(function () {
+        self.set('isLoading', false);
+      });
+    },
+
     resetActionResponse() {
       this.set('actionResponse', null);
     }
@@ -125,5 +152,13 @@ export default Ember.Controller.extend({
       amHostAddress = 'http://' + amHostAddress;
     }
     return amHostAddress;
+  }),
+
+  isKillable: Ember.computed("model.app.state", function () {
+    if (this.get("model.app.applicationType") === 'yarn-service') {
+      return false;
+    }
+    const killableStates = ['NEW', 'NEW_SAVING', 'SUBMITTED', 'ACCEPTED', 'RUNNING'];
+    return killableStates.indexOf(this.get("model.app.state")) > -1;
   })
 });

http://git-wip-us.apache.org/repos/asf/hadoop/blob/9832265e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
index 62e9350..156f83c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-app.hbs
@@ -18,6 +18,15 @@
 
 {{breadcrumb-bar breadcrumbs=breadcrumbs}}
 
+{{#if actionResponse}}
+  <div class="col-md-12">
+    <div class="alert alert-dismissible {{if (eq actionResponse.type 'error') 'alert-danger'
'alert-success'}}" role="alert">
+      <button class="close" data-dismiss="alert" aria-label="Close" {{action "resetActionResponse"}}><span
aria-hidden="true">&times;</span></button>
+      <strong>{{actionResponse.msg}}</strong>
+    </div>
+  </div>
+{{/if}}
+
 <div class="panel-group">
   <div class="panel panel-default">
     <div class="yarn-app-header">
@@ -64,18 +73,26 @@
 
         <div class="flex-right">
           <div class="links">
-            {{#if isRunningService}}
+              {{#if (or isRunningService isKillable)}}
               <div class="btn-group">
                 <button type="button" class="btn btn-unstyled dropdown-toggle" title="Settings"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                   <i class="glyphicon glyphicon-cog" />
                 </button>
                 <ul class="dropdown-menu dropdown-menu-right">
-                  <li>
-                    <a href="#"  {{action "showStopServiceConfirm"}} target="_blank"><i
class="glyphicon glyphicon-stop" /> &nbsp;Stop Service</a>
-                  </li>
-                  <li>
-                    <a href="#" target="_blank" {{action "showDeleteServiceConfirm"}}><i
class="glyphicon glyphicon-trash" /> &nbsp;Delete Service </a>
-                  </li>
+                  {{#if isRunningService}}
+                    <li>
+                      <a href="#"  {{action "showStopServiceConfirm"}} target="_blank"><i
class="glyphicon glyphicon-stop" /> &nbsp;Stop Service</a>
+                    </li>
+                    <li>
+                      <a href="#" target="_blank" {{action "showDeleteServiceConfirm"}}><i
class="glyphicon glyphicon-trash" /> &nbsp;Delete Service </a>
+                    </li>
+                  {{else if isKillable}}
+                    <li>
+                      <a href="#"  {{action "showKillApplicationConfirm"}} target="_blank">
+                        <i class="glyphicon glyphicon-stop" />&nbsp;Kill Application
+                      </a>
+                    </li>
+                  {{/if}}
                 </ul>
               </div>
             {{/if}}
@@ -147,3 +164,9 @@
   message=(concat 'Are you sure you want to delete service "' model.serviceName '" for user
"' model.app.user '" ?')
   action="deleteService"
 }}
+
+{{confirm-dialog
+  dialogId="killApplicationConfirmDialog"
+  message=(concat 'Are you sure you want to kill application "' model.app.id '"?')
+  action="killApplication"
+}}


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message