From f8e775a784b25dcf06dd0cca45177686913e07a7 Mon Sep 17 00:00:00 2001 From: Rees Dooley Date: Mon, 3 Feb 2014 16:03:17 -0600 Subject: [PATCH 1/4] Results timeout arg added to rqworker --- rq/scripts/rqworker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rq/scripts/rqworker.py b/rq/scripts/rqworker.py index 904ddea..5091b26 100644 --- a/rq/scripts/rqworker.py +++ b/rq/scripts/rqworker.py @@ -23,6 +23,7 @@ def parse_args(): parser.add_argument('--name', '-n', default=None, help='Specify a different name') parser.add_argument('--worker-class', '-w', action='store', default='rq.Worker', help='RQ Worker class to use') parser.add_argument('--path', '-P', default='.', help='Specify the import path.') + parser.add_argument('--timeout', '-t', default=None, help='Default results timeout for the worker to use') parser.add_argument('--verbose', '-v', action='store_true', default=False, help='Show more output') parser.add_argument('--quiet', '-q', action='store_true', default=False, help='Show less output') parser.add_argument('--sentry-dsn', action='store', default=None, metavar='URL', help='Report exceptions to this Sentry DSN') @@ -78,7 +79,7 @@ def main(): try: queues = list(map(Queue, args.queues)) - w = worker_class(queues, name=args.name) + w = worker_class(queues, name=args.name, default_result_ttl=args.timeout) # Should we configure Sentry? if args.sentry_dsn: From fb65e321edf13672a3b8557887e49257e34bb7ea Mon Sep 17 00:00:00 2001 From: Rees Dooley Date: Tue, 4 Feb 2014 09:33:04 -0600 Subject: [PATCH 2/4] Changed timeout to results_ttl. Added similar worker_ttl param --- rq/scripts/rqworker.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/rq/scripts/rqworker.py b/rq/scripts/rqworker.py index 5091b26..54818cc 100644 --- a/rq/scripts/rqworker.py +++ b/rq/scripts/rqworker.py @@ -23,7 +23,8 @@ def parse_args(): parser.add_argument('--name', '-n', default=None, help='Specify a different name') parser.add_argument('--worker-class', '-w', action='store', default='rq.Worker', help='RQ Worker class to use') parser.add_argument('--path', '-P', default='.', help='Specify the import path.') - parser.add_argument('--timeout', '-t', default=None, help='Default results timeout for the worker to use') + parser.add_argument('--results-ttl', '-rt', default=None, help='Default results timeout to be used') + parser.add_argument('--worker-ttl', '-wt', default=None, help='Default worker timeout to be used') parser.add_argument('--verbose', '-v', action='store_true', default=False, help='Show more output') parser.add_argument('--quiet', '-q', action='store_true', default=False, help='Show less output') parser.add_argument('--sentry-dsn', action='store', default=None, metavar='URL', help='Report exceptions to this Sentry DSN') @@ -79,7 +80,11 @@ def main(): try: queues = list(map(Queue, args.queues)) - w = worker_class(queues, name=args.name, default_result_ttl=args.timeout) + w = worker_class( + queues, + name=args.name, + default_worker_ttl=args.worker_ttl, + default_result_ttl=args.results_ttl) # Should we configure Sentry? if args.sentry_dsn: From f7e2375b36becea831c539805545aa35fa99949d Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Fri, 21 Feb 2014 07:55:22 +0100 Subject: [PATCH 3/4] Remove two-char short args. In UNIX, this would mean the shorthand notation for `-w -t`, which is confusing and conflicts with the existing `-w` and `-t` flags. Instead, if you need this, you'll have to spell the flag name out because we've run out of chars that make sense. --- rq/scripts/rqworker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rq/scripts/rqworker.py b/rq/scripts/rqworker.py index 54818cc..84dca34 100644 --- a/rq/scripts/rqworker.py +++ b/rq/scripts/rqworker.py @@ -23,8 +23,8 @@ def parse_args(): parser.add_argument('--name', '-n', default=None, help='Specify a different name') parser.add_argument('--worker-class', '-w', action='store', default='rq.Worker', help='RQ Worker class to use') parser.add_argument('--path', '-P', default='.', help='Specify the import path.') - parser.add_argument('--results-ttl', '-rt', default=None, help='Default results timeout to be used') - parser.add_argument('--worker-ttl', '-wt', default=None, help='Default worker timeout to be used') + parser.add_argument('--results-ttl', default=None, help='Default results timeout to be used') + parser.add_argument('--worker-ttl', default=None, help='Default worker timeout to be used') parser.add_argument('--verbose', '-v', action='store_true', default=False, help='Show more output') parser.add_argument('--quiet', '-q', action='store_true', default=False, help='Show less output') parser.add_argument('--sentry-dsn', action='store', default=None, metavar='URL', help='Report exceptions to this Sentry DSN') From d2bbd31c59bac8e53e1968bf8e639dec7667927b Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Fri, 21 Feb 2014 07:56:34 +0100 Subject: [PATCH 4/4] Fix some flake8 complaints. --- rq/scripts/rqworker.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/rq/scripts/rqworker.py b/rq/scripts/rqworker.py index 84dca34..c7e3fce 100644 --- a/rq/scripts/rqworker.py +++ b/rq/scripts/rqworker.py @@ -19,7 +19,7 @@ def parse_args(): parser = argparse.ArgumentParser(description='Starts an RQ worker.') add_standard_arguments(parser) - parser.add_argument('--burst', '-b', action='store_true', default=False, help='Run in burst mode (quit after all work is done)') + parser.add_argument('--burst', '-b', action='store_true', default=False, help='Run in burst mode (quit after all work is done)') # noqa parser.add_argument('--name', '-n', default=None, help='Specify a different name') parser.add_argument('--worker-class', '-w', action='store', default='rq.Worker', help='RQ Worker class to use') parser.add_argument('--path', '-P', default='.', help='Specify the import path.') @@ -27,7 +27,7 @@ def parse_args(): parser.add_argument('--worker-ttl', default=None, help='Default worker timeout to be used') parser.add_argument('--verbose', '-v', action='store_true', default=False, help='Show more output') parser.add_argument('--quiet', '-q', action='store_true', default=False, help='Show less output') - parser.add_argument('--sentry-dsn', action='store', default=None, metavar='URL', help='Report exceptions to this Sentry DSN') + parser.add_argument('--sentry-dsn', action='store', default=None, metavar='URL', help='Report exceptions to this Sentry DSN') # noqa parser.add_argument('--pid', action='store', default=None, help='Write the process ID number to a file at the specified path') parser.add_argument('queues', nargs='*', help='The queues to listen on (default: \'default\')') @@ -80,11 +80,10 @@ def main(): try: queues = list(map(Queue, args.queues)) - w = worker_class( - queues, - name=args.name, - default_worker_ttl=args.worker_ttl, - default_result_ttl=args.results_ttl) + w = worker_class(queues, + name=args.name, + default_worker_ttl=args.worker_ttl, + default_result_ttl=args.results_ttl) # Should we configure Sentry? if args.sentry_dsn: