]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
teuthology-queue: add --status 911/head
authorZack Cerza <zack@redhat.com>
Fri, 15 Jul 2016 22:40:37 +0000 (16:40 -0600)
committerZack Cerza <zack@redhat.com>
Fri, 15 Jul 2016 22:42:02 +0000 (16:42 -0600)
Prints queue status, e.g.:

    $ teuthology-queue -m smithi --status
    {'paused': False, 'count': 2900, 'name': 'smithi'}

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

index f3e2e73aa53f024aab3d8b6861d34e8c25ce5aaa..07cb4c7472d20e0081670616661170cc917fb4db 100644 (file)
@@ -5,7 +5,7 @@ import teuthology.beanstalk
 
 doc = """
 usage: teuthology-queue -h
-       teuthology-queue [-d|-f] -m MACHINE_TYPE
+       teuthology-queue [-s|-d|-f] -m MACHINE_TYPE
        teuthology-queue [-r] -m MACHINE_TYPE
        teuthology-queue -m MACHINE_TYPE -D PATTERN
        teuthology-queue -p SECONDS [-m MACHINE_TYPE]
@@ -24,6 +24,7 @@ optional arguments:
   -d, --description     Show job descriptions
   -r, --runs            Only show run names
   -f, --full            Print the entire job config. Use with caution.
+  -s, --status          Prints the status of the queue
   -p, --pause SECONDS   Pause queues for a number of seconds. A value of 0
                         will unpause. If -m is passed, pause that queue,
                         otherwise pause all queues.
index f913deb1c4244191e310eee5d4f45d72cc7dac93..8d97e82f830fb02ba0b0781c565921a1e3fba0e0 100644 (file)
@@ -171,8 +171,19 @@ def pause_tube(connection, tube, duration):
         connection.pause_tube(tube, duration)
 
 
+def stats_tube(connection, tube):
+    stats = connection.stats_tube(tube)
+    result = dict(
+        name=tube,
+        count=stats['current-jobs-ready'],
+        paused=(stats['pause'] != 0),
+    )
+    return result
+
+
 def main(args):
     machine_type = args['--machine_type']
+    status = args['--status']
     delete = args['--delete']
     runs = args['--runs']
     show_desc = args['--description']
@@ -184,7 +195,9 @@ def main(args):
             # watch_tube needs to be run before we inspect individual jobs;
             # it is not needed for pausing tubes
             watch_tube(connection, machine_type)
-        if pause_duration:
+        if status:
+            print stats_tube(connection, machine_type)
+        elif pause_duration:
             pause_tube(connection, machine_type, pause_duration)
         elif delete:
             walk_jobs(connection, machine_type,