]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Add --description flag
authorZack Cerza <zack@cerza.org>
Tue, 25 Mar 2014 20:38:34 +0000 (15:38 -0500)
committerZack Cerza <zack@cerza.org>
Tue, 25 Mar 2014 20:38:34 +0000 (15:38 -0500)
Default to not printing job descriptions. Add -d/--description flag to
control that behavior. Change --delete's short option to -D. Other small
output tweaks.

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
scripts/queue.py
teuthology/beanstalk.py

index 2aa239cc3af046af58e9d77d27fd919eaec25389..2dc1bd4b2b8174827c7d7856f1cae9118050dff1 100644 (file)
@@ -5,8 +5,8 @@ import teuthology.beanstalk
 
 doc = """
 usage: teuthology-queue -h
-       teuthology-queue -m MACHINE_TYPE
-       teuthology-queue -m MACHINE_TYPE -d PATTERN
+       teuthology-queue [-d] -m MACHINE_TYPE
+       teuthology-queue -m MACHINE_TYPE -D PATTERN
 
 List Jobs in queue:
   If -d then jobs with PATTERN in the job name are deleted from the queue.
@@ -16,9 +16,10 @@ Arguments:
                         Which machine type queue to work on.
 
 optional arguments:
-  -h, --help            show this help message and exit
+  -h, --help            Show this help message and exit
+  -D, --delete PATTERN  Delete Jobs with PATTERN in their name
+  -d, --description     Show job descriptions
 
-  -d, --delete PATTERN      Delete Jobs with PATTERN in their name.
 
 """.format(archive_base=teuthology.config.config.archive_base)
 
index 344ea798b1005a7fb6ce636eb9ac6c51c78408ee..bcc4ceb28bbd7c654b995db3bf82912a342cb243 100644 (file)
@@ -21,7 +21,7 @@ def beanstalk_connect(machine_type):
     return beanstalk
 
 
-def walk_jobs(beanstalk, machine_type, delete=None):
+def walk_jobs(beanstalk, machine_type, show_desc=False, delete=None):
     job_count = beanstalk.stats_tube(machine_type)['current-jobs-ready']
     if job_count == 0:
         log.info('No jobs in Beanstalk Queue')
@@ -48,14 +48,14 @@ def walk_jobs(beanstalk, machine_type, delete=None):
                         x=x, count=job_count)
                     print m,
             else:
-                m = 'Job: {x}/{count} ID: {job_id} Name: {job_name}'.format(
+                m = 'Job: {x}/{count} {job_name}/{job_id}'.format(
                     x=x,
                     count=job_count,
                     job_id=job_id,
                     job_name=job_name,
                     )
                 print m
-                if job_description:
+                if job_description and show_desc:
                     for desc in job_description.split():
                         print '\t {desc}'.format(desc=desc)
     log.info("Finished checking Beanstalk Queue.")
@@ -64,6 +64,7 @@ def walk_jobs(beanstalk, machine_type, delete=None):
 def main(args):
     machine_type = args['--machine_type']
     delete = args['--delete']
+    show_desc = args['--description']
     beanstalk = beanstalk_connect(machine_type)
-    walk_jobs(beanstalk, machine_type, delete)
+    walk_jobs(beanstalk, machine_type, show_desc=show_desc, delete=delete)
     beanstalk.close()