step4_controller.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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({
  21. name: "rMHighAvailabilityWizardStep4Controller",
  22. isRMHA: true,
  23. clusterDeployState: 'RM_HIGH_AVAILABILITY_DEPLOY',
  24. commands: ['stopRequiredServices', 'installResourceManager', 'reconfigureYARN', 'startAllServices'],
  25. tasksMessagesPrefix: 'admin.rm_highAvailability.wizard.step',
  26. stopRequiredServices: function () {
  27. var list = App.Service.find().mapProperty("serviceName").without("HDFS").join(',');
  28. App.ajax.send({
  29. name: 'common.services.update',
  30. sender: this,
  31. data: {
  32. "context": "Stop without HDFS",
  33. "ServiceInfo": {
  34. "state": "INSTALLED"
  35. },
  36. urlParams: "ServiceInfo/service_name.in(" + list + ")"},
  37. success: 'startPolling',
  38. error: 'onTaskError'
  39. });
  40. },
  41. installResourceManager: function () {
  42. var hostName = this.get('content.rmHosts.additionalRM');
  43. this.createComponent('RESOURCEMANAGER', hostName, "YARN");
  44. },
  45. reconfigureYARN: function () {
  46. this.loadConfigsTags();
  47. },
  48. loadConfigsTags: function () {
  49. App.ajax.send({
  50. name: 'config.tags',
  51. sender: this,
  52. success: 'onLoadConfigsTags',
  53. error: 'onTaskError'
  54. });
  55. },
  56. onLoadConfigsTags: function (data) {
  57. App.ajax.send({
  58. name: 'reassign.load_configs',
  59. sender: this,
  60. data: {
  61. urlParams: '(type=yarn-site&tag=' + data.Clusters.desired_configs['yarn-site'].tag + ')'
  62. },
  63. success: 'onLoadConfigs',
  64. error: 'onTaskError'
  65. });
  66. },
  67. onLoadConfigs: function (data) {
  68. var propertiesToAdd = this.get('content.configs');
  69. propertiesToAdd.forEach(function (property) {
  70. data.items[0].properties[property.name] = property.value;
  71. });
  72. var configData = this.reconfigureSites(['yarn-site'],data);
  73. App.ajax.send({
  74. name: 'common.service.configurations',
  75. sender: this,
  76. data: {
  77. desired_config: configData
  78. },
  79. success: 'onSaveConfigs',
  80. error: 'onTaskError'
  81. });
  82. },
  83. onSaveConfigs: function () {
  84. this.onTaskCompleted();
  85. },
  86. startAllServices: function () {
  87. App.ajax.send({
  88. name: 'common.services.update',
  89. sender: this,
  90. data: {
  91. "context": "Start all services",
  92. "ServiceInfo": {
  93. "state": "STARTED"
  94. },
  95. urlParams: "params/run_smoke_test=true"
  96. },
  97. success: 'startPolling',
  98. error: 'onTaskError'
  99. });
  100. }
  101. });