]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
teuthology-queue --pause 537/head
authorZack Cerza <zack@redhat.com>
Fri, 19 Jun 2015 16:20:42 +0000 (10:20 -0600)
committerZack Cerza <zack@redhat.com>
Fri, 19 Jun 2015 16:50:01 +0000 (10:50 -0600)
Signed-off-by: Zack Cerza <zack@redhat.com>
scripts/queue.py
teuthology/beanstalk.py

index 733d1b290ddd1fb8209a52f6c22d83f03732e24d..f3e2e73aa53f024aab3d8b6861d34e8c25ce5aaa 100644 (file)
@@ -8,6 +8,7 @@ usage: teuthology-queue -h
        teuthology-queue [-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]
 
 List Jobs in queue.
 If -D is passed, then jobs with PATTERN in the job name are deleted from the
@@ -23,6 +24,9 @@ optional arguments:
   -d, --description     Show job descriptions
   -r, --runs            Only show run names
   -f, --full            Print the entire job config. Use with caution.
+  -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.
 """.format(archive_base=teuthology.config.config.archive_base)
 
 
index f2d20fc14b18662c85fe12917153c1da7702126a..1cd755eb9fc44ef7659affbb421eccbd88036638 100644 (file)
@@ -155,16 +155,36 @@ class JobDeleter(JobProcessor):
         report.try_delete_jobs(job_name, job_id)
 
 
+def pause_tube(connection, tube, duration):
+    duration = int(duration)
+    if not tube:
+        tubes = sorted(connection.tubes())
+    else:
+        tubes = [tube]
+
+    prefix = 'Unpausing' if duration == 0 else "Pausing for {dur}s"
+    templ = prefix + ": {tubes}"
+    log.info(templ.format(dur=duration, tubes=tubes))
+    for tube in tubes:
+        connection.pause_tube(tube, duration)
+
+
 def main(args):
     machine_type = args['--machine_type']
     delete = args['--delete']
     runs = args['--runs']
     show_desc = args['--description']
     full = args['--full']
+    pause_duration = args['--pause']
     try:
         connection = connect()
-        watch_tube(connection, machine_type)
-        if delete:
+        if machine_type and not pause_duration:
+            # 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:
+            pause_tube(connection, machine_type, pause_duration)
+        elif delete:
             walk_jobs(connection, machine_type,
                       JobDeleter(delete))
         elif runs: