Be more informative if owner info is missing

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
This commit is contained in:
Zack Cerza 2014-08-11 14:55:49 -06:00
parent edfeffe3dd
commit 293c2bd49c
2 changed files with 6 additions and 2 deletions

View File

@ -7,8 +7,8 @@ doc = """
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 [-a ARCHIVE] [-o OWNER] -r RUN -j JOB ...
teuthology-kill [-a ARCHIVE] [-o OWNER] -J JOBSPEC
teuthology-kill [-p] -o OWNER -m MACHINE_TYPE -r RUN
Kill running teuthology jobs:

View File

@ -64,6 +64,10 @@ def kill_job(run_name, job_id, archive_base=None, owner=None,
machine_type=None):
serializer = report.ResultsSerializer(archive_base)
job_info = serializer.job_info(run_name, job_id)
if not owner and 'owner' not in job_info:
raise RuntimeError(
"I could not figure out the owner of the requested job. "
"Please pass --owner <owner>.")
owner = job_info['owner']
kill_processes(run_name, [job_info.get('pid')])
targets = dict(targets=job_info.get('targets', {}))