step4_controller.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. require('controllers/main/admin/serviceAccounts_controller');
  20. App.RMHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageController.extend(App.WizardEnableDone, {
  21. name: "rMHighAvailabilityWizardStep4Controller",
  22. clusterDeployState: 'RM_HIGH_AVAILABILITY_DEPLOY',
  23. commands: ['stopRequiredServices', 'installResourceManager', 'reconfigureYARN', 'reconfigureHAWQ', 'startAllServices'],
  24. tasksMessagesPrefix: 'admin.rm_highAvailability.wizard.step',
  25. initializeTasks: function () {
  26. this._super();
  27. var numSpliced = 0;
  28. if (!App.Service.find().someProperty('serviceName', 'HAWQ')) {
  29. this.get('tasks').splice(this.get('tasks').findProperty('command', 'reconfigureHAWQ').get('id'), 1);
  30. }
  31. },
  32. stopRequiredServices: function () {
  33. this.stopServices(['HDFS']);
  34. },
  35. installResourceManager: function () {
  36. var hostName = this.get('content.rmHosts.additionalRM');
  37. this.createComponent('RESOURCEMANAGER', hostName, "YARN");
  38. },
  39. reconfigureYARN: function () {
  40. this.loadConfigsTags("Yarn");
  41. },
  42. reconfigureHAWQ: function () {
  43. this.loadConfigsTags("Hawq");
  44. },
  45. loadConfigsTags: function (service) {
  46. onLoadServiceConfigsTags = 'onLoad' + service + "ConfigsTags"
  47. App.ajax.send({
  48. name: 'config.tags',
  49. sender: this,
  50. success: onLoadServiceConfigsTags,
  51. error: 'onTaskError'
  52. });
  53. },
  54. onLoadYarnConfigsTags: function (data) {
  55. App.ajax.send({
  56. name: 'reassign.load_configs',
  57. sender: this,
  58. data: {
  59. urlParams: '(type=yarn-site&tag=' + data.Clusters.desired_configs['yarn-site'].tag + ')'
  60. },
  61. success: 'onLoadYarnConfigs',
  62. error: 'onTaskError'
  63. });
  64. },
  65. onLoadHawqConfigsTags: function (data) {
  66. App.ajax.send({
  67. name: 'reassign.load_configs',
  68. sender: this,
  69. data: {
  70. urlParams: '(type=yarn-client&tag=' + data.Clusters.desired_configs['yarn-client'].tag + ')'
  71. },
  72. success: 'onLoadHawqConfigs',
  73. error: 'onTaskError'
  74. });
  75. },
  76. onLoadYarnConfigs: function (data) {
  77. var propertiesToAdd = this.get('content.configs').filterProperty('filename', 'yarn-site');
  78. propertiesToAdd.forEach(function (property) {
  79. data.items[0].properties[property.name] = property.value;
  80. });
  81. var configData = this.reconfigureSites(['yarn-site'], data, Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role('RESOURCEMANAGER')));
  82. App.ajax.send({
  83. name: 'common.service.configurations',
  84. sender: this,
  85. data: {
  86. desired_config: configData
  87. },
  88. success: 'onSaveConfigs',
  89. error: 'onTaskError'
  90. });
  91. },
  92. onLoadHawqConfigs: function (data) {
  93. var propertiesToAdd = this.get('content.configs').filterProperty('filename', 'yarn-client');
  94. propertiesToAdd.forEach(function (property) {
  95. data.items[0].properties[property.name] = property.value;
  96. });
  97. var configData = this.reconfigureSites(['yarn-client'], data, Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role('RESOURCEMANAGER')));
  98. App.ajax.send({
  99. name: 'common.service.configurations',
  100. sender: this,
  101. data: {
  102. desired_config: configData
  103. },
  104. success: 'onSaveConfigs',
  105. error: 'onTaskError'
  106. });
  107. },
  108. onSaveConfigs: function () {
  109. this.onTaskCompleted();
  110. },
  111. startAllServices: function () {
  112. this.startServices(true);
  113. }
  114. });