ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odiache...@apache.org
Subject ambari git commit: AMBARI-14351. Add custom action to stop hawq cluster and segments with immediate mode (bhuvnesh chaudhary via odiachenko).
Date Tue, 29 Dec 2015 19:39:03 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 a9b3c6c04 -> 59a885f81


AMBARI-14351. Add custom action to stop hawq cluster and segments with immediate mode (bhuvnesh
chaudhary via odiachenko).


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/59a885f8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/59a885f8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/59a885f8

Branch: refs/heads/branch-2.2
Commit: 59a885f81684ef3a9182693ac3216c126ed13e25
Parents: a9b3c6c
Author: Oleksandr Diachenko <odiachenko@pivotal.io>
Authored: Tue Dec 29 11:38:57 2015 -0800
Committer: Oleksandr Diachenko <odiachenko@pivotal.io>
Committed: Tue Dec 29 11:38:57 2015 -0800

----------------------------------------------------------------------
 .../common-services/HAWQ/2.0.0/metainfo.xml     | 20 ++++++++++++++++++++
 .../2.0.0/package/scripts/hawq_constants.py     |  3 +++
 .../HAWQ/2.0.0/package/scripts/hawqmaster.py    |  5 ++++-
 .../HAWQ/2.0.0/package/scripts/hawqsegment.py   | 10 ++++++----
 .../HAWQ/2.0.0/package/scripts/hawqstandby.py   |  2 +-
 .../HAWQ/2.0.0/package/scripts/master_helper.py | 10 +++++-----
 6 files changed, 39 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/59a885f8/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 8635554..5418e4e 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
@@ -36,6 +36,16 @@
             <scriptType>PYTHON</scriptType>
             <timeout>1200</timeout>
           </commandScript>
+          <customCommands>
+            <customCommand>
+              <name>IMMEDIATE_STOP_CLUSTER</name>
+              <commandScript>
+                <script>scripts/hawqmaster.py</script>
+                <scriptType>PYTHON</scriptType>
+                <timeout>1200</timeout>
+              </commandScript>
+            </customCommand>
+          </customCommands>
           <dependencies>
             <dependency>
               <name>HDFS/NAMENODE</name>
@@ -85,6 +95,16 @@
             <scriptType>PYTHON</scriptType>
             <timeout>600</timeout>
           </commandScript>
+          <customCommands>
+            <customCommand>
+              <name>IMMEDIATE_STOP</name>
+              <commandScript>
+                <script>scripts/hawqsegment.py</script>
+                <scriptType>PYTHON</scriptType>
+                <timeout>1200</timeout>
+              </commandScript>
+            </customCommand>
+          </customCommands>
         </component>
       </components> 
       <requiredServices>

http://git-wip-us.apache.org/repos/asf/ambari/blob/59a885f8/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawq_constants.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawq_constants.py
b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawq_constants.py
index 6edb327..90021b1 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawq_constants.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawq_constants.py
@@ -24,6 +24,9 @@ START = "start"
 INIT = "init"
 STOP = "stop"
 YARN = "yarn"
+CLUSTER = "cluster"
+IMMEDIATE = "immediate"
+FAST = "fast"
 
 # Users
 root_user = "root"

http://git-wip-us.apache.org/repos/asf/ambari/blob/59a885f8/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 c886325..8c7b0b5 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
@@ -45,11 +45,14 @@ class HawqMaster(Script):
     master_helper.start_master()
 
   def stop(self, env):
-    master_helper.stop_master()
+    master_helper.stop()
 
   def status(self, env):
     from hawqstatus import get_pid_file
     check_process_status(get_pid_file())
 
+  def immediate_stop_cluster(self, env):
+    master_helper.stop(hawq_constants.IMMEDIATE, hawq_constants.CLUSTER)
+
 if __name__ == "__main__":
   HawqMaster().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/59a885f8/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 a99f0f7..37a118c 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
@@ -49,7 +49,7 @@ class HawqSegment(Script):
     import params
     return utils.exec_hawq_operation(
           hawq_constants.START, 
-          "{0} -a".format(hawq_constants.SEGMENT), 
+          "{0} -a -v".format(hawq_constants.SEGMENT), 
           not_if=utils.chk_hawq_process_status_cmd(params.hawq_segment_address_port))
 
   def start(self, env):
@@ -64,10 +64,9 @@ class HawqSegment(Script):
     self.__init_segment()
 
 
-  def stop(self, env):
+  def stop(self, env, mode=hawq_constants.FAST):
     import params
-
-    utils.exec_hawq_operation(hawq_constants.STOP, "{0} -a".format(hawq_constants.SEGMENT),
only_if=utils.chk_hawq_process_status_cmd(
+    utils.exec_hawq_operation(hawq_constants.STOP, "{0} -M {1} -a -v".format(hawq_constants.SEGMENT,
mode), only_if=utils.chk_hawq_process_status_cmd(
                                 params.hawq_segment_address_port))
 
 
@@ -75,6 +74,9 @@ class HawqSegment(Script):
     from hawqstatus import get_pid_file
     check_process_status(get_pid_file())
 
+  def immediate_stop(self, env):
+    self.stop(env, mode=hawq_constants.IMMEDIATE)
+
 
   @staticmethod
   def __init_segment():

http://git-wip-us.apache.org/repos/asf/ambari/blob/59a885f8/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 ad81319..7f5bab4 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
@@ -45,7 +45,7 @@ class HawqStandby(Script):
     master_helper.start_master()
 
   def stop(self, env):
-    master_helper.stop_master()
+    master_helper.stop()
 
   def status(self, env):
     from hawqstatus import get_pid_file

http://git-wip-us.apache.org/repos/asf/ambari/blob/59a885f8/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
index f0a0593..7182e9e 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/master_helper.py
@@ -123,7 +123,7 @@ def __start_local_master():
   component_name = __get_component_name()
   utils.exec_hawq_operation(
         hawq_constants.START, 
-        "{0} -a".format(component_name),
+        "{0} -a -v".format(component_name),
         not_if=utils.chk_hawq_process_status_cmd(params.hawq_master_address_port, component_name))
 
   
@@ -178,15 +178,15 @@ def start_master():
     __init_standby()
 
 
-def stop_master():
+def stop(mode=hawq_constants.FAST, component=None):
   """
-  Stops the HAWQ Master/Standby
+  Stops the HAWQ Master/Standby, if component is cluster performs cluster level operation
from master
   """
   import params
-  component_name = __get_component_name()
+  component_name = component if component else __get_component_name()
   utils.exec_hawq_operation(
                 hawq_constants.STOP,
-                "{0} -a".format(component_name),
+                "{0} -M {1} -a -v".format(component_name, mode),
                 only_if=utils.chk_hawq_process_status_cmd(params.hawq_master_address_port,
component_name))
 
 


Mime
View raw message