]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
nuke - optionally kill the process hung
authortamil <tamil@tamil-VirtualBox.(none)>
Tue, 3 Jul 2012 19:22:26 +0000 (12:22 -0700)
committertamil <tamil@tamil-VirtualBox.(none)>
Tue, 3 Jul 2012 19:23:36 +0000 (12:23 -0700)
Added a function kill_process to kill the process hung in the nightly runs.
It takes in pid as an optional argument.

Signed-off-by: tamil <tamil.muthamizhan@inktank.com>
teuthology/misc.py
teuthology/nuke.py

index 22f503c243f4090c0dd9d026412e1046ffa5897d..5c6c113925a07f38b5c3290cdc5c35f1c9ea7edf 100644 (file)
@@ -10,6 +10,7 @@ import urllib2
 import urlparse
 import yaml
 import json
+import subprocess
 
 from .orchestra import run
 
@@ -423,6 +424,9 @@ def get_clients(ctx, roles):
 def get_user():
     return getpass.getuser() + '@' + socket.gethostname()
 
+def kill_process(ctx):
+       subprocess.check_call(["kill", "-9", str(ctx.pid)]);
+
 def read_config(ctx):
     filename = os.path.join(os.environ['HOME'], '.teuthology.yaml')
     ctx.teuthology_config = {}
index 8cd704b62b180cf34fdd57da106ef9b493a0aeec..8aa5b8b7443cb8885f920614c1dc3c1bfb581ba0 100644 (file)
@@ -30,6 +30,12 @@ def parse_args():
         '--owner',
         help='job owner',
         )
+    parser.add_argument(
+        '-p','--pid',
+       type=int,
+       default=False,
+        help='pid of the process to be deleted',
+        )
     parser.add_argument(
         '-r', '--reboot-all',
         action='store_true',
@@ -262,8 +268,11 @@ def main():
         from teuthology.misc import get_user
         ctx.owner = get_user()
 
-    nuke(ctx, log, ctx.unlock, ctx.synch_clocks, ctx.reboot_all)
+    if ctx.pid:
+       from teuthology.misc import kill_process
+       kill_process(ctx)
 
+    nuke(ctx, log, ctx.unlock, ctx.synch_clocks, ctx.reboot_all)
 
 def nuke(ctx, log, should_unlock, sync_clocks=True, reboot_all=True):
     from teuthology.parallel import parallel