From: Zack Cerza Date: Wed, 5 Feb 2014 19:31:10 +0000 (-0600) Subject: Enable killing runs that haven't even started yet X-Git-Tag: 1.1.0~1676^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F185%2Fhead;p=teuthology.git Enable killing runs that haven't even started yet This requires passing --machine-type. Signed-off-by: Zack Cerza --- diff --git a/scripts/kill.py b/scripts/kill.py index f639bf23e..deec8511b 100644 --- a/scripts/kill.py +++ b/scripts/kill.py @@ -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) diff --git a/teuthology/kill.py b/teuthology/kill.py index ec039ebf2..402643488 100755 --- a/teuthology/kill.py +++ b/teuthology/kill.py @@ -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,