From c68b5fc9dd3c66d6a095378b6da85b5a43b1cb95 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Fri, 11 Jul 2014 14:55:09 -0600 Subject: [PATCH] Add a flag to dump the entire job body. ... with a warning. Signed-off-by: Zack Cerza --- scripts/queue.py | 3 ++- teuthology/beanstalk.py | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/queue.py b/scripts/queue.py index 15bbafdc1f..2436013d03 100644 --- a/scripts/queue.py +++ b/scripts/queue.py @@ -5,7 +5,7 @@ import teuthology.beanstalk doc = """ usage: teuthology-queue -h - teuthology-queue [-d] -m MACHINE_TYPE + teuthology-queue [-d|-f] -m MACHINE_TYPE teuthology-queue [-r] -m MACHINE_TYPE teuthology-queue -m MACHINE_TYPE -D PATTERN @@ -22,6 +22,7 @@ optional arguments: -D, --delete PATTERN Delete Jobs with PATTERN in their name -d, --description Show job descriptions -r, --runs Only show run names + -f, --full Print the entire job config. Use with caution. """.format(archive_base=teuthology.config.config.archive_base) diff --git a/teuthology/beanstalk.py b/teuthology/beanstalk.py index 7bf9698ad2..f2d20fc14b 100644 --- a/teuthology/beanstalk.py +++ b/teuthology/beanstalk.py @@ -1,6 +1,7 @@ import beanstalkc import yaml import logging +import pprint import sys from collections import OrderedDict @@ -97,9 +98,10 @@ class JobProcessor(object): class JobPrinter(JobProcessor): - def __init__(self, show_desc=False): + def __init__(self, show_desc=False, full=False): super(JobPrinter, self).__init__() self.show_desc = show_desc + self.full = full def process_job(self, job_id): job_config = self.jobs[job_id]['job_config'] @@ -111,7 +113,9 @@ class JobPrinter(JobProcessor): job_id=job_id, job_name=job_name, ) - if job_desc and self.show_desc: + if self.full: + pprint.pprint(job_config) + elif job_desc and self.show_desc: for desc in job_desc.split(): print '\t {desc}'.format(desc=desc) @@ -156,6 +160,7 @@ def main(args): delete = args['--delete'] runs = args['--runs'] show_desc = args['--description'] + full = args['--full'] try: connection = connect() watch_tube(connection, machine_type) @@ -167,7 +172,7 @@ def main(args): RunPrinter()) else: walk_jobs(connection, machine_type, - JobPrinter(show_desc=show_desc)) + JobPrinter(show_desc=show_desc, full=full)) except KeyboardInterrupt: log.info("Interrupted.") finally: -- 2.39.5