瀏覽代碼

YARN-9543. [UI2] Handle ATSv2 server down or failures cases gracefully in YARN UI v2. Contributed by Zoltan Siegl and Akhil P B.

Sunil G 6 年之前
父節點
當前提交
52128e352a

+ 4 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.gitignore

@@ -0,0 +1,4 @@
+tmp/
+node_modules/
+bower_components/
+dist/

+ 30 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/timeline-health.js

@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import RESTAbstractAdapter from './restabstract';
+
+export default RESTAbstractAdapter.extend({
+  address: "timelineWebAddress",
+  restNameSpace: "timelineV2",
+  serverName: "ATS",
+
+  urlForQueryRecord(/*query, modelName*/) {
+    var url = this.buildURL();
+    return url + '/health';
+  }
+});

+ 7 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js

@@ -73,4 +73,11 @@ export default Ember.Controller.extend({
     }
     return null;
   }.property('model.userInfo'),
+
+  isTimelineUnHealthy: function() {
+    if (this.model && this.model.timelineHealth) {
+      return this.model.timelineHealth.get('isTimelineUnHealthy');
+    }
+    return true;
+  }.property('model.timelineHealth')
 });

+ 27 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/timeline-health.js

@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import DS from 'ember-data';
+
+export default DS.Model.extend({
+  healthStatus: DS.attr('string'),
+
+  isTimelineUnHealthy: function() {
+    return this.get('healthStatus') !== 'RUNNING';
+  }.property('healthStatus')
+});

+ 4 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js

@@ -27,6 +27,9 @@ export default AbstractRoute.extend({
       }),
       userInfo: this.store.findAll('cluster-user-info', {reload: true}).catch(function() {
         return null;
+      }),
+      timelineHealth: this.store.queryRecord('timeline-health', {}).catch(function() {
+        return null;
       })
     });
   },
@@ -56,5 +59,6 @@ export default AbstractRoute.extend({
   unloadAll: function() {
     this.store.unloadAll('ClusterInfo');
     this.store.unloadAll('cluster-user-info');
+    this.store.unloadAll('timeline-health');
   },
 });

+ 3 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/timeline-error.js

@@ -19,6 +19,9 @@
 import Ember from 'ember';
 
 export default Ember.Route.extend({
+  model() {
+    return {};
+  },
   afterModel(model/*, transition*/) {
     model.error_id = "error";
     model.isValidErrorCode = false;

+ 31 - 0
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/timeline-health.js

@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import DS from 'ember-data';
+
+export default DS.JSONAPISerializer.extend({
+  normalizeSingleResponse(store, primaryModelClass, payload) {
+    var fixedPayload = {
+      id: Date.now(),
+      type: primaryModelClass.modelName,
+      attributes: payload
+    };
+
+    return { data: fixedPayload };
+  }
+});

+ 2 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs

@@ -56,8 +56,8 @@
               <span class="sr-only">(current)</span>
             {{/link-to}}
           {{/link-to}}
-          {{#link-to 'yarn-flow-activity' tagName="li"}}
-            {{#link-to 'yarn-flow-activity' class="navigation-link"}}Flow Activity
+          {{#link-to 'yarn-flow-activity' tagName="li" disabled=isTimelineUnHealthy}}
+            {{#link-to 'yarn-flow-activity' class="navigation-link" disabled=isTimelineUnHealthy}}Flow Activity
               <span class="sr-only">(current)</span>
             {{/link-to}}
           {{/link-to}}