From 36880db872b858f1613e71082dd1075c90f52ef1 Mon Sep 17 00:00:00 2001 From: zhangliyong Date: Fri, 15 Aug 2014 14:20:00 +0800 Subject: [PATCH] Show progressbar when requeuing --- rq/scripts/rq.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/rq/scripts/rq.py b/rq/scripts/rq.py index 668a58b..f15e543 100755 --- a/rq/scripts/rq.py +++ b/rq/scripts/rq.py @@ -47,14 +47,14 @@ def requeue(): """Requeue all failed jobs in failed queue""" failed_queue = get_failed_queue() job_ids = failed_queue.job_ids - click.echo('Requeuing {} failed jobs......'.format(len(job_ids))) + click.echo('Requeue failed jobs: {}'.format(len(job_ids))) requeue_failed_num = 0 - for job_id in job_ids: - try: - failed_queue.requeue(job_id) - except InvalidJobOperationError: - click.echo('Requeue job({}) failed'.format(job_id)) - requeue_failed_num += 1 - - click.secho('Requeue over with {} jobs requeuing failed'.format( + with click.progressbar(job_ids) as job_bar: + for job_id in job_bar: + try: + failed_queue.requeue(job_id) + except InvalidJobOperationError: + requeue_failed_num += 1 + + click.secho('Requeue failed: {}'.format( requeue_failed_num), fg='red')