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
-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)
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,