ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lpus...@apache.org
Subject [07/36] ambari git commit: AMBARI-21339 logviewer started along with nimbus if supervisor is not running on the same machine
Date Fri, 14 Jul 2017 12:54:05 GMT
AMBARI-21339 logviewer started along with nimbus if supervisor is not running on the same machine


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

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 1939dabcd7f6eeff3bb93e4d6f718b8a32351bd2
Parents: 6832ed9
Author: lpuskas <lpuskas@apache.org>
Authored: Thu Jun 29 17:11:59 2017 +0200
Committer: lpuskas <laszlo.puskas@sequenceiq.com>
Committed: Fri Jul 7 11:23:12 2017 +0200

----------------------------------------------------------------------
 .../STORM/0.9.1/package/scripts/nimbus.py       |  8 ++-
 .../stacks/2.1/STORM/test_storm_nimbus.py       | 60 +++++++++++++++++++-
 .../stacks/2.1/configs/default-storm-start.json | 14 +++++
 .../test/python/stacks/2.1/configs/default.json | 13 +++++
 .../stacks/2.1/configs/secured-storm-start.json | 13 +++++
 .../test/python/stacks/2.1/configs/secured.json | 15 ++++-
 6 files changed, 119 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1939dabc/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus.py
b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus.py
index 360af5d..126ae78 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus.py
@@ -70,12 +70,18 @@ class NimbusDefault(Nimbus):
     setup_ranger_storm(upgrade_type=upgrade_type)
     service("nimbus", action="start")
 
+    if "SUPERVISOR" not in params.config['localComponents']:
+      service("logviewer", action="start")
+
 
   def stop(self, env, upgrade_type=None):
     import params
     env.set_params(params)
     service("nimbus", action="stop")
 
+    if "SUPERVISOR" not in params.config['localComponents']:
+      service("logviewer", action="stop")
+
 
   def status(self, env):
     import status_params
@@ -85,7 +91,7 @@ class NimbusDefault(Nimbus):
   def get_log_folder(self):
     import params
     return params.log_dir
-  
+
   def get_user(self):
     import params
     return params.storm_user

http://git-wip-us.apache.org/repos/asf/ambari/blob/1939dabc/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py
index 35f057c..fd25126 100644
--- a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py
+++ b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_nimbus.py
@@ -58,6 +58,15 @@ class TestStormNimbus(TestStormBase):
         owner = 'storm',
         group = 'hadoop',
     )
+    self.assertResourceCalled('Execute', 'source /etc/storm/conf/storm-env.sh ; export PATH=$JAVA_HOME/bin:$PATH
; storm logviewer > /var/log/storm/logviewer.out 2>&1 &\n echo $! > /var/run/storm/logviewer.pid',
+        path = ['/usr/bin'],
+        user = 'storm',
+        not_if = "ambari-sudo.sh su storm -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]ls
/var/run/storm/logviewer.pid >/dev/null 2>&1 && ps -p `cat /var/run/storm/logviewer.pid`
>/dev/null 2>&1'",
+    )
+    self.assertResourceCalled('File', '/var/run/storm/logviewer.pid',
+        owner = 'storm',
+        group = 'hadoop',
+    )
     self.assertNoMoreResources()
 
   def test_start_with_metrics_collector(self):
@@ -99,6 +108,15 @@ class TestStormNimbus(TestStormBase):
         owner = 'storm',
         group = 'hadoop',
     )
+    self.assertResourceCalled('Execute', 'source /etc/storm/conf/storm-env.sh ; export PATH=$JAVA_HOME/bin:$PATH
; storm logviewer > /var/log/storm/logviewer.out 2>&1 &\n echo $! > /var/run/storm/logviewer.pid',
+      path = ['/usr/bin'],
+      user = 'storm',
+      not_if = "ambari-sudo.sh su storm -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]ls /var/run/storm/logviewer.pid
>/dev/null 2>&1 && ps -p `cat /var/run/storm/logviewer.pid` >/dev/null
2>&1'",
+    )
+    self.assertResourceCalled('File', '/var/run/storm/logviewer.pid',
+      owner = 'storm',
+      group = 'hadoop',
+    )
     self.assertNoMoreResources()
 
   def test_start_with_metrics_collector_modern(self):
@@ -141,12 +159,21 @@ class TestStormNimbus(TestStormBase):
         owner = 'storm',
         group = 'hadoop',
     )
+    self.assertResourceCalled('Execute', 'source /etc/storm/conf/storm-env.sh ; export PATH=$JAVA_HOME/bin:$PATH
; storm logviewer > /var/log/storm/logviewer.out 2>&1 &\n echo $! > /var/run/storm/logviewer.pid',
+      path = ['/usr/bin'],
+      user = 'storm',
+      not_if = "ambari-sudo.sh su storm -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]ls /var/run/storm/logviewer.pid
>/dev/null 2>&1 && ps -p `cat /var/run/storm/logviewer.pid` >/dev/null
2>&1'",
+    )
+    self.assertResourceCalled('File', '/var/run/storm/logviewer.pid',
+      owner = 'storm',
+      group = 'hadoop',
+    )
     self.assertNoMoreResources()
 
   @patch("os.path.exists")
   def test_stop_default(self, path_exists_mock):
     # Bool for the pid file
-    path_exists_mock.side_effect = [True]
+    path_exists_mock.side_effect = [True, True]
     self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/nimbus.py",
                        classname = "Nimbus",
                        command = "stop",
@@ -164,6 +191,16 @@ class TestStormNimbus(TestStormBase):
     self.assertResourceCalled('File', '/var/run/storm/nimbus.pid',
         action = ['delete'],
     )
+    self.assertResourceCalled('Execute', "ambari-sudo.sh kill 123",
+      not_if = "! (ambari-sudo.sh su storm -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]ls
/var/run/storm/logviewer.pid >/dev/null 2>&1 && ps -p `cat /var/run/storm/logviewer.pid`
>/dev/null 2>&1')",
+    )
+    self.assertResourceCalled('Execute', "ambari-sudo.sh kill -9 123",
+      not_if = "sleep 2; ! (ambari-sudo.sh su storm -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]ls
/var/run/storm/logviewer.pid >/dev/null 2>&1 && ps -p `cat /var/run/storm/logviewer.pid`
>/dev/null 2>&1') || sleep 20; ! (ambari-sudo.sh su storm -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]ls
/var/run/storm/logviewer.pid >/dev/null 2>&1 && ps -p `cat /var/run/storm/logviewer.pid`
>/dev/null 2>&1')",
+      ignore_failures = True,
+    )
+    self.assertResourceCalled('File', '/var/run/storm/logviewer.pid',
+      action = ['delete'],
+    )
     self.assertNoMoreResources()
 
   def test_configure_secured(self):
@@ -196,12 +233,21 @@ class TestStormNimbus(TestStormBase):
         owner = 'storm',
         group = 'hadoop',
     )
+    self.assertResourceCalled('Execute', 'source /etc/storm/conf/storm-env.sh ; export PATH=$JAVA_HOME/bin:$PATH
; storm logviewer > /var/log/storm/logviewer.out 2>&1 &\n echo $! > /var/run/storm/logviewer.pid',
+        path = ['/usr/bin'],
+        user = 'storm',
+        not_if = "ambari-sudo.sh su storm -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]ls
/var/run/storm/logviewer.pid >/dev/null 2>&1 && ps -p `cat /var/run/storm/logviewer.pid`
>/dev/null 2>&1'",
+    )
+    self.assertResourceCalled('File', '/var/run/storm/logviewer.pid',
+        owner = 'storm',
+        group = 'hadoop',
+    )
     self.assertNoMoreResources()
 
   @patch("os.path.exists")
   def test_stop_secured(self, path_exists_mock):
     # Bool for the pid file
-    path_exists_mock.side_effect = [True]
+    path_exists_mock.side_effect = [True, True]
     self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/nimbus.py",
                        classname = "Nimbus",
                        command = "stop",
@@ -219,6 +265,16 @@ class TestStormNimbus(TestStormBase):
     self.assertResourceCalled('File', '/var/run/storm/nimbus.pid',
         action = ['delete'],
     )
+    self.assertResourceCalled('Execute', "ambari-sudo.sh kill 123",
+      not_if = "! (ambari-sudo.sh su storm -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]ls
/var/run/storm/logviewer.pid >/dev/null 2>&1 && ps -p `cat /var/run/storm/logviewer.pid`
>/dev/null 2>&1')",
+    )
+    self.assertResourceCalled('Execute', "ambari-sudo.sh kill -9 123",
+      not_if = "sleep 2; ! (ambari-sudo.sh su storm -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]ls
/var/run/storm/logviewer.pid >/dev/null 2>&1 && ps -p `cat /var/run/storm/logviewer.pid`
>/dev/null 2>&1') || sleep 20; ! (ambari-sudo.sh su storm -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]ls
/var/run/storm/logviewer.pid >/dev/null 2>&1 && ps -p `cat /var/run/storm/logviewer.pid`
>/dev/null 2>&1')",
+      ignore_failures = True,
+    )
+    self.assertResourceCalled('File', '/var/run/storm/logviewer.pid',
+      action = ['delete'],
+    )
     self.assertNoMoreResources()
 
   def test_pre_upgrade_restart(self):

http://git-wip-us.apache.org/repos/asf/ambari/blob/1939dabc/ambari-server/src/test/python/stacks/2.1/configs/default-storm-start.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/configs/default-storm-start.json b/ambari-server/src/test/python/stacks/2.1/configs/default-storm-start.json
index 27cb63e..05330a0 100644
--- a/ambari-server/src/test/python/stacks/2.1/configs/default-storm-start.json
+++ b/ambari-server/src/test/python/stacks/2.1/configs/default-storm-start.json
@@ -1,4 +1,18 @@
 {
+    "localComponents": [
+        "APP_TIMELINE_SERVER",
+        "TEZ_CLIENT",
+        "DATANODE",
+        "HDFS_CLIENT",
+        "ZOOKEEPER_SERVER",
+        "RESOURCEMANAGER",
+        "MAPREDUCE2_CLIENT",
+        "YARN_CLIENT",
+        "HISTORYSERVER",
+        "ZOOKEEPER_CLIENT",
+        "NAMENODE"
+    ],
+
     "configuration_attributes": {
         "storm-site": {},
         "hdfs-site": {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1939dabc/ambari-server/src/test/python/stacks/2.1/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/configs/default.json b/ambari-server/src/test/python/stacks/2.1/configs/default.json
index e04e1eb..536074e 100644
--- a/ambari-server/src/test/python/stacks/2.1/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.1/configs/default.json
@@ -1,4 +1,17 @@
 {
+    "localComponents": [
+        "APP_TIMELINE_SERVER",
+        "TEZ_CLIENT",
+        "DATANODE",
+        "HDFS_CLIENT",
+        "ZOOKEEPER_SERVER",
+        "RESOURCEMANAGER",
+        "MAPREDUCE2_CLIENT",
+        "YARN_CLIENT",
+        "HISTORYSERVER",
+        "ZOOKEEPER_CLIENT",
+        "NAMENODE"
+    ],
     "roleCommand": "SERVICE_CHECK", 
     "clusterName": "c1", 
     "hostname": "c6401.ambari.apache.org", 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1939dabc/ambari-server/src/test/python/stacks/2.1/configs/secured-storm-start.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/configs/secured-storm-start.json b/ambari-server/src/test/python/stacks/2.1/configs/secured-storm-start.json
index 1b027b7..6d7fdd1 100644
--- a/ambari-server/src/test/python/stacks/2.1/configs/secured-storm-start.json
+++ b/ambari-server/src/test/python/stacks/2.1/configs/secured-storm-start.json
@@ -1,4 +1,17 @@
 {
+    "localComponents": [
+        "APP_TIMELINE_SERVER",
+        "TEZ_CLIENT",
+        "DATANODE",
+        "HDFS_CLIENT",
+        "ZOOKEEPER_SERVER",
+        "RESOURCEMANAGER",
+        "MAPREDUCE2_CLIENT",
+        "YARN_CLIENT",
+        "HISTORYSERVER",
+        "ZOOKEEPER_CLIENT",
+        "NAMENODE"
+    ],
     "configuration_attributes": {
         "storm-site": {}, 
         "hdfs-site": {

http://git-wip-us.apache.org/repos/asf/ambari/blob/1939dabc/ambari-server/src/test/python/stacks/2.1/configs/secured.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/configs/secured.json b/ambari-server/src/test/python/stacks/2.1/configs/secured.json
index 61b359c..e2c22be 100644
--- a/ambari-server/src/test/python/stacks/2.1/configs/secured.json
+++ b/ambari-server/src/test/python/stacks/2.1/configs/secured.json
@@ -1,5 +1,18 @@
 {
-    "roleCommand": "INSTALL", 
+  "localComponents": [
+    "APP_TIMELINE_SERVER",
+    "TEZ_CLIENT",
+    "DATANODE",
+    "HDFS_CLIENT",
+    "ZOOKEEPER_SERVER",
+    "RESOURCEMANAGER",
+    "MAPREDUCE2_CLIENT",
+    "YARN_CLIENT",
+    "HISTORYSERVER",
+    "ZOOKEEPER_CLIENT",
+    "NAMENODE"
+  ],
+    "roleCommand": "INSTALL",
     "clusterName": "c1", 
     "hostname": "c6401.ambari.apache.org", 
     "hostLevelParams": {


Mime
View raw message