]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Enable killing runs that haven't even started yet 185/head
authorZack Cerza <zack@cerza.org>
Wed, 5 Feb 2014 19:31:10 +0000 (13:31 -0600)
committerZack Cerza <zack@cerza.org>
Wed, 5 Feb 2014 19:43:34 +0000 (13:43 -0600)
This requires passing --machine-type.

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
scripts/kill.py
teuthology/kill.py

index f639bf23e3239c1a1b00355c68147f943157439a..deec8511b168a187d689369c3a4c4af4a8e31e17 100644 (file)
@@ -5,6 +5,7 @@ import teuthology.kill
 
 doc = """
 usage: teuthology-kill [-h] [-a ARCHIVE] -r RUN
+       teuthology-kill [-h] [-a ARCHIVE] -m MACHINE_TYPE -r RUN
        teuthology-kill [-h] [-a ARCHIVE] -r RUN -j JOB ...
        teuthology-kill [-h] -o OWNER -m MACHINE_TYPE -r RUN
 
@@ -22,7 +23,9 @@ optional arguments:
   -j, --job JOB         The job_id of the job to kill
   -o, --owner OWNER     The owner of the job(s)
   -m, --machine_type MACHINE_TYPE
-                        The type of machine the job(s) are running on
+                        The type of machine the job(s) are running on.
+                        This is required if killing a job that is still
+                        entirely in the queue.
 """.format(archive_base=teuthology.config.config.archive_base)
 
 
index ec039ebf2b15f1faa3d75ee27e62d6538ecd1c59..402643488f54a7c8656f69a9b930a2f0902db734 100755 (executable)
@@ -31,14 +31,19 @@ def kill_run(run_name, archive_base=None, owner=None, machine_type=None):
     run_info = {}
     if archive_base:
         run_archive_dir = os.path.join(archive_base, run_name)
-        run_info = find_run_info(run_archive_dir)
-        machine_type = run_info['machine_type']
-        owner = run_info['owner']
+        if os.path.isdir(run_archive_dir):
+            run_info = find_run_info(run_archive_dir)
+            machine_type = run_info['machine_type']
+            owner = run_info['owner']
+        elif machine_type is None:
+            raise RuntimeError("The run is still entirely enqueued; " +
+                               "you must also pass --machine-type")
 
     remove_beanstalk_jobs(run_name, machine_type)
     kill_processes(run_name, run_info.get('pids'))
-    targets = find_targets(run_name, owner)
-    nuke_targets(targets, owner)
+    if owner is not None:
+        targets = find_targets(run_name, owner)
+        nuke_targets(targets, owner)
 
 
 def kill_job(run_name, job_id, archive_base=None, owner=None,