#4817 Improve the runworker script so it accepts task module and queue name
Merged 3 years ago by pingou. Opened 3 years ago by pingou.

file modified
+17 -1
@@ -23,6 +23,19 @@ 

      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 @@ 

          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")

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 pingou@pingoured.fr

Since this isn't tested in our test suite, I'm just going to merge it :)

Pull-Request has been merged by pingou

3 years ago