From 253dcde5176a266998aaed0b9f7d10b922e40330 Mon Sep 17 00:00:00 2001 From: Sunil G Date: Fri, 31 May 2019 12:29:44 +0530 Subject: [PATCH] YARN-9543. [UI2] Handle ATSv2 server down or failures cases gracefully in YARN UI v2. Contributed by Zoltan Siegl and Akhil P B. (cherry picked from commit 52128e352a30b70b83483f9290d9e94e98929705) --- .../hadoop-yarn-ui/src/main/webapp/.gitignore | 4 +++ .../webapp/app/adapters/timeline-health.js | 30 ++++++++++++++++++ .../webapp/app/controllers/application.js | 7 +++++ .../main/webapp/app/models/timeline-health.js | 27 ++++++++++++++++ .../src/main/webapp/app/routes/application.js | 4 +++ .../main/webapp/app/routes/timeline-error.js | 3 ++ .../webapp/app/serializers/timeline-health.js | 31 +++++++++++++++++++ .../main/webapp/app/templates/application.hbs | 4 +-- 8 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.gitignore create mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/timeline-health.js create mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/timeline-health.js create mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/timeline-health.js diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.gitignore b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.gitignore new file mode 100644 index 00000000000..338997fcf7d --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/.gitignore @@ -0,0 +1,4 @@ +tmp/ +node_modules/ +bower_components/ +dist/ diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/timeline-health.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/adapters/timeline-health.js new file mode 100644 index 00000000000..8ca23106306 --- /dev/null +++ b/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'; + } +}); \ No newline at end of file diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js index 50a290912ae..34702aca2df 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/controllers/application.js +++ b/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') }); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/timeline-health.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/models/timeline-health.js new file mode 100644 index 00000000000..367ab07d787 --- /dev/null +++ b/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') +}); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js index adb57b19c49..ead17e1ac53 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/application.js +++ b/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'); }, }); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/timeline-error.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/timeline-error.js index c2e5fc5c209..54fc8d4c1bb 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/routes/timeline-error.js +++ b/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; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/timeline-health.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/timeline-health.js new file mode 100644 index 00000000000..79fb4610ef0 --- /dev/null +++ b/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 }; + } +}); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs index ecb1481d7aa..1d469d9ce80 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/application.hbs @@ -56,8 +56,8 @@ (current) {{/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 (current) {{/link-to}} {{/link-to}}