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 52128e352a)
This commit is contained in:
Sunil G 2019-05-31 12:29:44 +05:30
parent bc028d3ebb
commit c343554e2a
8 changed files with 108 additions and 2 deletions

View File

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

View File

@ -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';
}
});

View File

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

View File

@ -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')
});

View File

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

View File

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

View File

@ -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 };
}
});

View File

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