From 51ed35d4b78df704c98e4268b6bec2c97de10675 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 17 2020 15:09:45 +0000 Subject: Improve the runworker script so it accepts task module and queue name This is most useful if you want for example to run the tasks in the pagure.lib.tasks_service module and with the queue load_json. Signed-off-by: Pierre-Yves Chibon --- diff --git a/runworker.py b/runworker.py index 80a61b6..914ed15 100755 --- a/runworker.py +++ b/runworker.py @@ -23,6 +23,19 @@ parser.add_argument( help="Expand the level of data returned.", ) parser.add_argument( + "--queue", + dest="queue", + default=None, + help="Name of the queue to run the worker against.", +) + +parser.add_argument( + "--tasks", + dest="tasks", + default="pagure.lib.tasks", + help="Class used by the workers.", +) +parser.add_argument( "--noinfo", dest="noinfo", action="store_true", @@ -40,7 +53,10 @@ if args.config: config = os.path.join(here, config) env["PAGURE_CONFIG"] = config -cmd = [sys.executable, "-m", "celery", "worker", "-A", "pagure.lib.tasks"] +cmd = [sys.executable, "-m", "celery", "worker", "-A", args.tasks] + +if args.queue: + cmd.extend(["-Q", args.queue]) if args.debug: cmd.append("--loglevel=debug")