atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject incubator-atlas git commit: ATLAS-1733: updated atlas_stop.py script to work in Windows environment
Date Tue, 11 Jul 2017 16:41:43 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/0.8-incubating 688064fbf -> 13d5bfbff


ATLAS-1733: updated atlas_stop.py script to work in Windows environment

Signed-off-by: Madhan Neethiraj <madhan@apache.org>
(cherry picked from commit ad398393f712fdbb689a33883182f65f8ef58ac7)


Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/13d5bfbf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/13d5bfbf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/13d5bfbf

Branch: refs/heads/0.8-incubating
Commit: 13d5bfbff07477df2fc2c1055b61d4891b04d5c4
Parents: 688064f
Author: Graham Wallis <graham_wallis@uk.ibm.com>
Authored: Tue Jul 11 09:26:45 2017 -0700
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Tue Jul 11 09:41:37 2017 -0700

----------------------------------------------------------------------
 distro/src/bin/atlas_stop.py | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/13d5bfbf/distro/src/bin/atlas_stop.py
----------------------------------------------------------------------
diff --git a/distro/src/bin/atlas_stop.py b/distro/src/bin/atlas_stop.py
index a25d25a..66edd90 100755
--- a/distro/src/bin/atlas_stop.py
+++ b/distro/src/bin/atlas_stop.py
@@ -15,8 +15,18 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+
+
+# Signal handling is OS-specific because there is no SIGKILL on Windows.
+
 import os
-from signal import SIGTERM, SIGKILL
+
+if os.name == "nt":
+  # Attempting to import SIGKILL on Windows would cause script to fail.
+  from signal import SIGTERM
+else:
+  from signal import SIGTERM, SIGKILL
+
 import sys
 import traceback
 import time
@@ -63,15 +73,22 @@ def main():
     # stop hbase
     if mc.is_hbase_local(confdir):
         mc.run_hbase_action(mc.hbaseBinDir(atlas_home), "stop", None, None, True)
-		
+
     if mc.exist_pid(pid):
         #after 30 seconds kill it
         time.sleep(30)
         try:
-            sys.stderr.write("did not stop gracefully after 30 seconds seconds: killing with
SIGKILL\n")
-            os.kill(pid, SIGKILL)
+
+            if os.name == "nt":
+              # If running on Windows then timeout termination uses SIGTERM instead of SIGKILL.
+              sys.stderr.write("did not stop gracefully after 30 seconds: killing process
using SIGTERM\n")
+              os.kill(pid, SIGTERM)
+            else:
+              sys.stderr.write("did not stop gracefully after 30 seconds: killing process
using SIGKILL\n")
+              os.kill(pid, SIGKILL)
+
         except:
-            pass			
+            pass
 
 if __name__ == '__main__':
     try:


Mime
View raw message