ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oleew...@apache.org
Subject ambari git commit: AMBARI-17801. Kill Solr process if not stopped properly (Miklos Gergely via oleewere)
Date Wed, 20 Jul 2016 10:51:28 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk ac3d0fe7e -> ddd8d425e


AMBARI-17801. Kill Solr process if not stopped properly (Miklos Gergely via oleewere)


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

Branch: refs/heads/trunk
Commit: ddd8d425e990bb0401c7497c4e73c7cd761c91d3
Parents: ac3d0fe
Author: Miklos Gergely <mgergely@hortonworks.com>
Authored: Wed Jul 20 12:33:55 2016 +0200
Committer: oleewere <oleewere@gmail.com>
Committed: Wed Jul 20 12:50:01 2016 +0200

----------------------------------------------------------------------
 .../0.5.0/package/scripts/logsearch_solr.py     | 24 +++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ddd8d425/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_solr.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_solr.py
b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_solr.py
index f033b96..4f89bd3 100644
--- a/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_solr.py
+++ b/ambari-server/src/main/resources/common-services/LOGSEARCH/0.5.0/package/scripts/logsearch_solr.py
@@ -22,6 +22,9 @@ from resource_management.libraries.functions.format import format
 from resource_management.libraries.functions.check_process_status import check_process_status
 from resource_management.libraries.script.script import Script
 from setup_logsearch_solr import setup_logsearch_solr
+from logsearch_common import kill_process
+from resource_management.core.logger import Logger
+import sys
 
 class LogsearchSolr(Script):
   def install(self, env):
@@ -50,14 +53,19 @@ class LogsearchSolr(Script):
     import params
     env.set_params(params)
 
-    Execute(format('{solr_bindir}/solr stop -all >> {logsearch_solr_log}'),
-            environment={'SOLR_INCLUDE': format('{logsearch_solr_conf}/logsearch-solr-env.sh')},
-            user=params.logsearch_solr_user,
-            only_if=format("test -f {logsearch_solr_pidfile}")
-            )
-    File(params.logsearch_solr_pidfile,
-         action="delete"
-         )
+    try:
+      Execute(format('{solr_bindir}/solr stop -all >> {logsearch_solr_log}'),
+              environment={'SOLR_INCLUDE': format('{logsearch_solr_conf}/logsearch-solr-env.sh')},
+              user=params.logsearch_solr_user,
+              only_if=format("test -f {logsearch_solr_pidfile}")
+              )
+      
+      File(params.logsearch_solr_pidfile,
+           action="delete"
+           )
+    except:
+      Logger.warning("Could not stop solr:" + str(sys.exc_info()[1]) + "\n Trying to kill
it")
+      kill_process(params.logsearch_solr_pidfile, params.logsearch_solr_user, params.logsearch_solr_log_dir);
 
   def status(self, env):
     import status_params


Mime
View raw message