You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/02/18 14:33:25 UTC
[06/33] ambari git commit: AMBARI-15022: Add Custom action to sync
Standby with Master (goutamtadi via jaoki)
AMBARI-15022: Add Custom action to sync Standby with Master (goutamtadi via jaoki)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f41fccfc
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f41fccfc
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f41fccfc
Branch: refs/heads/branch-dev-patch-upgrade
Commit: f41fccfc829919546fcb8e2a79a36a4b477affa6
Parents: f18601c
Author: Jun Aoki <ja...@apache.org>
Authored: Tue Feb 16 11:33:30 2016 -0800
Committer: Jun Aoki <ja...@apache.org>
Committed: Tue Feb 16 11:33:30 2016 -0800
----------------------------------------------------------------------
.../common-services/HAWQ/2.0.0/metainfo.xml | 14 ++++--
.../HAWQ/2.0.0/package/scripts/hawqmaster.py | 2 +-
.../HAWQ/2.0.0/package/scripts/hawqsegment.py | 2 +-
.../HAWQ/2.0.0/package/scripts/hawqstandby.py | 10 ++++-
.../hawq/activateStandby/step3_controller.js | 2 +-
ambari-web/app/controllers/main/service/item.js | 46 ++++++++++----------
ambari-web/app/messages.js | 5 ++-
ambari-web/app/models/host_component.js | 27 ++++++++----
ambari-web/app/utils/helper.js | 14 ++++++
ambari-web/app/views/main/service/item.js | 41 +++++++++--------
10 files changed, 104 insertions(+), 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f41fccfc/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/metainfo.xml b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/metainfo.xml
index 7a71604..fd145f4 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/metainfo.xml
@@ -39,7 +39,7 @@
</commandScript>
<customCommands>
<customCommand>
- <name>IMMEDIATE_STOP_CLUSTER</name>
+ <name>IMMEDIATE_STOP_HAWQ_SERVICE</name>
<commandScript>
<script>scripts/hawqmaster.py</script>
<scriptType>PYTHON</scriptType>
@@ -78,7 +78,15 @@
</commandScript>
<customCommands>
<customCommand>
- <name>ACTIVATE_STANDBY</name>
+ <name>ACTIVATE_HAWQ_STANDBY</name>
+ <commandScript>
+ <script>scripts/hawqstandby.py</script>
+ <scriptType>PYTHON</scriptType>
+ <timeout>1200</timeout>
+ </commandScript>
+ </customCommand>
+ <customCommand>
+ <name>RESYNC_HAWQ_STANDBY</name>
<commandScript>
<script>scripts/hawqstandby.py</script>
<scriptType>PYTHON</scriptType>
@@ -110,7 +118,7 @@
</commandScript>
<customCommands>
<customCommand>
- <name>IMMEDIATE_STOP</name>
+ <name>IMMEDIATE_STOP_HAWQ_SEGMENT</name>
<commandScript>
<script>scripts/hawqsegment.py</script>
<scriptType>PYTHON</scriptType>
http://git-wip-us.apache.org/repos/asf/ambari/blob/f41fccfc/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqmaster.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqmaster.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqmaster.py
index 8c7b0b5..d2f9ad0 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqmaster.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqmaster.py
@@ -51,7 +51,7 @@ class HawqMaster(Script):
from hawqstatus import get_pid_file
check_process_status(get_pid_file())
- def immediate_stop_cluster(self, env):
+ def immediate_stop_hawq_service(self, env):
master_helper.stop(hawq_constants.IMMEDIATE, hawq_constants.CLUSTER)
if __name__ == "__main__":
http://git-wip-us.apache.org/repos/asf/ambari/blob/f41fccfc/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
index 6bc9802..0a597b6 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
@@ -73,7 +73,7 @@ class HawqSegment(Script):
from hawqstatus import get_pid_file
check_process_status(get_pid_file())
- def immediate_stop(self, env):
+ def immediate_stop_hawq_segment(self, env):
self.stop(env, mode=hawq_constants.IMMEDIATE)
http://git-wip-us.apache.org/repos/asf/ambari/blob/f41fccfc/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqstandby.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqstandby.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqstandby.py
index 7da7f6d..0f52b9e 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqstandby.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqstandby.py
@@ -18,6 +18,7 @@ limitations under the License.
"""
from resource_management import Script
from resource_management.libraries.functions.check_process_status import check_process_status
+from resource_management.core.logger import Logger
import master_helper
import common
@@ -51,10 +52,15 @@ class HawqStandby(Script):
from hawqstatus import get_pid_file
check_process_status(get_pid_file())
- def activate_standby(self, env):
+ def activate_hawq_standby(self, env):
import utils
utils.exec_hawq_operation(hawq_constants.ACTIVATE, "{0} -a -M {1} -v".format(hawq_constants.STANDBY, hawq_constants.FAST))
-
+ def resync_hawq_standby(self,env):
+ import params
+ import utils
+ Logger.info("Re-synchronizing HAWQ Standby..")
+ utils.exec_hawq_operation(hawq_constants.INIT, "{0} -n -a -v -M {1}".format(hawq_constants.STANDBY, hawq_constants.FAST))
+ Logger.info("HAWQ Standby host {0} Re-Sync successful".format(params.hostname))
if __name__ == "__main__":
HawqStandby().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/f41fccfc/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
index 55da44e..7dbf992 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
@@ -25,7 +25,7 @@ App.ActivateHawqStandbyWizardStep3Controller = App.HighAvailabilityProgressPageC
clusterDeployState: 'ACTIVATE_HAWQ_STANDBY',
- hawqActivateStandbyCustomCommand: "ACTIVATE_STANDBY",
+ hawqActivateStandbyCustomCommand: "ACTIVATE_HAWQ_STANDBY",
hawqServiceName: "HAWQ",
http://git-wip-us.apache.org/repos/asf/ambari/blob/f41fccfc/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index a127e92..e26a884 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -524,29 +524,6 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
},
/**
- * On click handler for hawq stop cluster command from items menu
- */
-
- immediateStopHawqCluster: function(context) {
- var controller = this;
- return App.showConfirmationPopup(function() {
- App.ajax.send({
- name: 'service.item.executeCustomCommand',
- sender: controller,
- data: {
- command: context.command,
- context: Em.I18n.t('services.service.actions.run.immediateStopHawqCluster.context'),
- hosts: App.Service.find(context.service).get('hostComponents').findProperty('componentName', 'HAWQMASTER').get('hostName'),
- serviceName: context.service,
- componentName: context.component
- },
- success : 'executeCustomCommandSuccessCallback',
- error : 'executeCustomCommandErrorCallback'
- });
- });
- },
-
- /**
* On click handler for rebalance Hdfs command from items menu
*/
rebalanceHdfsNodes: function () {
@@ -925,6 +902,29 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
},
/**
+ * On click handler for custom hawq command from items menu
+ * @param context
+ */
+ executeHawqCustomCommand: function(context) {
+ var controller = this;
+ return App.showConfirmationPopup(function() {
+ App.ajax.send({
+ name : 'service.item.executeCustomCommand',
+ sender: controller,
+ data : {
+ command : context.command,
+ context : context.label,
+ hosts : App.Service.find(context.service).get('hostComponents').findProperty('componentName', context.component).get('hostName'),
+ serviceName : context.service,
+ componentName : context.component
+ },
+ success : 'executeCustomCommandSuccessCallback',
+ error : 'executeCustomCommandErrorCallback'
+ });
+ });
+ },
+
+ /**
* On click handler for custom command from items menu
* @param context
*/
http://git-wip-us.apache.org/repos/asf/ambari/blob/f41fccfc/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 08ff073..8186088 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1684,9 +1684,12 @@ Em.I18n.translations = {
'services.service.actions.run.stopLdapKnox.title':'Stop Demo LDAP Knox Gateway',
'services.service.actions.run.stopLdapKnox.context':'Stop Demo LDAP',
'services.service.actions.run.startStopLdapKnox.error': 'Error during remote command: ',
- 'services.service.actions.run.immediateStopHawqCluster.context':'Stop HAWQ Cluster (Immediate Mode)',
+ 'services.service.actions.run.immediateStopHawqService.context':'Stop HAWQ Service (Immediate Mode)',
+ 'services.service.actions.run.immediateStopHawqService.label':'Stop HAWQ Service (Immediate Mode)',
'services.service.actions.run.immediateStopHawqSegment.label':'Stop (Immediate Mode)',
'services.service.actions.run.immediateStopHawqSegment.context':'Stop HAWQ Segment (Immediate Mode)',
+ 'services.service.actions.run.resyncHawqStandby.context':'Re-Sync HAWQ Standby',
+ 'services.service.actions.run.resyncHawqStandby.label':'Re-Synchronize HAWQ Standby',
'services.service.actions.manage_configuration_groups.short':'Manage Config Groups',
'services.service.actions.serviceActions':'Service Actions',
http://git-wip-us.apache.org/repos/asf/ambari/blob/f41fccfc/ambari-web/app/models/host_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js
index 4782190..d3d4ab9 100644
--- a/ambari-web/app/models/host_component.js
+++ b/ambari-web/app/models/host_component.js
@@ -271,6 +271,7 @@ App.HostComponentActionMap = {
var RA = ctx.get('controller.content.hostComponents').findProperty('componentName', 'RANGER_ADMIN');
var HM = ctx.get('controller.content.hostComponents').findProperty('componentName', 'HAWQMASTER');
var HS = ctx.get('controller.content.hostComponents').findProperty('componentName', 'HAWQSTANDBY');
+ var HMComponent = App.MasterComponent.find('HAWQMASTER');
return {
RESTART_ALL: {
action: 'restartAllHostComponents',
@@ -374,20 +375,29 @@ App.HostComponentActionMap = {
hasSubmenu: ctx.get('controller.isSeveralClients'),
submenuOptions: ctx.get('controller.clientComponents')
},
- IMMEDIATE_STOP_CLUSTER: {
- action: 'immediateStopHawqCluster',
- customCommand: 'IMMEDIATE_STOP_CLUSTER',
- context: Em.I18n.t('services.service.actions.run.immediateStopHawqCluster.context'),
- label: Em.I18n.t('services.service.actions.run.immediateStopHawqCluster.context'),
+ IMMEDIATE_STOP_HAWQ_SERVICE: {
+ action: 'executeHawqCustomCommand',
+ customCommand: 'IMMEDIATE_STOP_HAWQ_SERVICE',
+ context: Em.I18n.t('services.service.actions.run.immediateStopHawqService.context'),
+ label: Em.I18n.t('services.service.actions.run.immediateStopHawqService.label'),
cssClass: 'icon-stop',
disabled: !HM || HM.get('workStatus') != App.HostComponentStatus.started
},
- IMMEDIATE_STOP: {
- customCommand: 'IMMEDIATE_STOP',
+ IMMEDIATE_STOP_HAWQ_SEGMENT: {
+ customCommand: 'IMMEDIATE_STOP_HAWQ_SEGMENT',
context: Em.I18n.t('services.service.actions.run.immediateStopHawqSegment.context'),
label: Em.I18n.t('services.service.actions.run.immediateStopHawqSegment.label'),
cssClass: 'icon-stop'
},
+ RESYNC_HAWQ_STANDBY: {
+ action: 'executeHawqCustomCommand',
+ customCommand: 'RESYNC_HAWQ_STANDBY',
+ context: Em.I18n.t('services.service.actions.run.resyncHawqStandby.context'),
+ label: Em.I18n.t('services.service.actions.run.resyncHawqStandby.label'),
+ cssClass: 'icon-refresh',
+ isHidden : App.get('isSingleNode') || !HS ,
+ disabled: !((!!HMComponent && HMComponent.get('startedCount') === 1) && (!!HS && HS.get('workStatus') === App.HostComponentStatus.started))
+ },
MASTER_CUSTOM_COMMAND: {
action: 'executeCustomCommand',
cssClass: 'icon-play-circle',
@@ -407,9 +417,10 @@ App.HostComponentActionMap = {
isHidden: App.get('isSingleNode') || HS,
disabled: false
},
- TOGGLE_ACTIVATE_HAWQ_STANDBY: {
+ ACTIVATE_HAWQ_STANDBY: {
action: 'activateHawqStandby',
label: Em.I18n.t('admin.activateHawqStandby.button.enable'),
+ context: Em.I18n.t('admin.activateHawqStandby.button.enable'),
cssClass: 'icon-arrow-up',
isHidden: App.get('isSingleNode') || !HS,
disabled: false
http://git-wip-us.apache.org/repos/asf/ambari/blob/f41fccfc/ambari-web/app/utils/helper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js
index a1d4b30..8f4985f 100644
--- a/ambari-web/app/utils/helper.js
+++ b/ambari-web/app/utils/helper.js
@@ -659,6 +659,20 @@ App.format = {
if (result === ' Refreshqueues ResourceManager') {
result = Em.I18n.t('services.service.actions.run.yarnRefreshQueues.title');
}
+ // HAWQ custom commands on back Ops page.
+ if (result === ' Resync Hawq Standby HAWQ Standby Master') {
+ result = Em.I18n.t('services.service.actions.run.resyncHawqStandby.label');
+ }
+ if (result === ' Immediate Stop Hawq Service HAWQ Master') {
+ result = Em.I18n.t('services.service.actions.run.immediateStopHawqService.label');
+ }
+ if (result === ' Immediate Stop Hawq Segment HAWQ Segment') {
+ result = Em.I18n.t('services.service.actions.run.immediateStopHawqSegment.label');
+ }
+ if(result === ' Activate Hawq Standby HAWQ Standby Master') {
+ result = Em.I18n.t('admin.activateHawqStandby.button.enable');
+ }
+ //<---End HAWQ custom commands--->
return result;
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/f41fccfc/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index d5d65e4..e74a588 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -35,9 +35,9 @@ App.MainServiceItemView = Em.View.extend({
'RESOURCEMANAGER': ['DECOMMISSION', 'REFRESHQUEUES'],
'HBASE_MASTER': ['DECOMMISSION'],
'KNOX_GATEWAY': ['STARTDEMOLDAP','STOPDEMOLDAP'],
- 'HAWQMASTER': ['IMMEDIATE_STOP_CLUSTER'],
- 'HAWQSTANDBY': ['ACTIVATE_STANDBY'],
- 'HAWQSEGMENT': ['IMMEDIATE_STOP']
+ 'HAWQMASTER': ['IMMEDIATE_STOP_HAWQ_SERVICE'],
+ 'HAWQSEGMENT': ['IMMEDIATE_STOP_HAWQ_SEGMENT'],
+ 'HAWQSTANDBY' : ['RESYNC_HAWQ_STANDBY','ACTIVATE_HAWQ_STANDBY']
},
addActionMap: function() {
@@ -172,7 +172,6 @@ App.MainServiceItemView = Em.View.extend({
break;
case 'HAWQ':
options.push(actionMap.TOGGLE_ADD_HAWQ_STANDBY);
- options.push(actionMap.TOGGLE_ACTIVATE_HAWQ_STANDBY);
break;
}
}
@@ -198,21 +197,25 @@ App.MainServiceItemView = Em.View.extend({
});
}
- var hawqMasterComponent = App.StackServiceComponent.find().findProperty('componentName','HAWQMASTER');
- if (serviceName === 'HAWQ' && hawqMasterComponent) {
- var hawqMasterCustomCommands = hawqMasterComponent.get('customCommands');
- customCommandToStopCluster = 'IMMEDIATE_STOP_CLUSTER';
- if (hawqMasterCustomCommands && hawqMasterCustomCommands.contains(customCommandToStopCluster)) {
- options.push(self.createOption(actionMap.IMMEDIATE_STOP_CLUSTER, {
- label: Em.I18n.t('services.service.actions.run.immediateStopHawqCluster.context'),
- context: {
- label: Em.I18n.t('services.service.actions.run.immediateStopHawqCluster.context'),
- service: hawqMasterComponent.get('serviceName'),
- component: hawqMasterComponent.get('componentName'),
- command: customCommandToStopCluster
- }
- }));
- }
+ /**
+ * Display all custom commands of Master and StandBy on Service page.
+ **/
+ if(serviceName === 'HAWQ') {
+ var hawqMasterComponent = App.StackServiceComponent.find().findProperty('componentName','HAWQMASTER');
+ var hawqStandByComponent = App.StackServiceComponent.find().findProperty('componentName','HAWQSTANDBY');
+ components = [hawqMasterComponent,hawqStandByComponent]
+ components.forEach(function(component){
+ component.get('customCommands').forEach(function(command){
+ options.push(self.createOption(actionMap[command], {
+ context: {
+ label: actionMap[command].context,
+ service: component.get('serviceName'),
+ component: component.get('componentName'),
+ command: command
+ }
+ }));
+ });
+ });
}
self.addActionMap().filterProperty('service', serviceName).forEach(function(item) {