From: Zack Cerza Date: Fri, 19 Jun 2015 16:20:42 +0000 (-0600) Subject: teuthology-queue --pause X-Git-Tag: 1.1.0~906^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f0762e7a135015689f94f074c9911e83b218055e;p=teuthology.git teuthology-queue --pause Signed-off-by: Zack Cerza --- diff --git a/scripts/queue.py b/scripts/queue.py index 733d1b290d..f3e2e73aa5 100644 --- a/scripts/queue.py +++ b/scripts/queue.py @@ -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) diff --git a/teuthology/beanstalk.py b/teuthology/beanstalk.py index f2d20fc14b..1cd755eb9f 100644 --- a/teuthology/beanstalk.py +++ b/teuthology/beanstalk.py @@ -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: