From 5cd50a42bef01f19ac25b888cc694c4fb42f50d6 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Fri, 20 Jun 2014 11:36:55 -0400 Subject: [PATCH] Allow killing jobs by passing a 'jobspec'. See teuthology-kill --help Signed-off-by: Zack Cerza --- scripts/kill.py | 5 +++++ teuthology/kill.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/scripts/kill.py b/scripts/kill.py index cef3e0ca84a2b..f46bb7c52c18f 100644 --- a/scripts/kill.py +++ b/scripts/kill.py @@ -8,6 +8,7 @@ usage: teuthology-kill -h teuthology-kill [-a ARCHIVE] [-p] -r RUN teuthology-kill [-a ARCHIVE] [-p] -m MACHINE_TYPE -r RUN teuthology-kill [-a ARCHIVE] -r RUN -j JOB ... + teuthology-kill [-a ARCHIVE] -J JOBSPEC teuthology-kill [-p] -o OWNER -m MACHINE_TYPE -r RUN Kill running teuthology jobs: @@ -23,6 +24,10 @@ optional arguments: -p, --preserve-queue Preserve the queue - do not delete queued jobs -r, --run RUN The name(s) of the run(s) to kill -j, --job JOB The job_id of the job to kill + -J, --jobspec JOBSPEC + The 'jobspec' of the job to kill. A jobspec consists of + both the name of the run and the job_id, separated by a + '/'. e.g. 'my-test-run/1234' -o, --owner OWNER The owner of the job(s) -m, --machine_type MACHINE_TYPE The type of machine the job(s) are running on. diff --git a/teuthology/kill.py b/teuthology/kill.py index c8f746e3eaebc..6ea9359b4326d 100755 --- a/teuthology/kill.py +++ b/teuthology/kill.py @@ -18,11 +18,17 @@ log = logging.getLogger(__name__) def main(args): run_name = args['--run'] job = args['--job'] + jobspec = args['--jobspec'] archive_base = args['--archive'] owner = args['--owner'] machine_type = args['--machine_type'] preserve_queue = args['--preserve-queue'] + if jobspec: + split_spec = jobspec.split('/') + run_name = split_spec[0] + job = [split_spec[1]] + if job: for job_id in job: kill_job(run_name, job_id, archive_base, owner, machine_type) -- 2.39.5