Skip to content

Commit

Permalink
Respect queue parameter of worker
Browse files Browse the repository at this point in the history
  • Loading branch information
medihack authored Jun 30, 2024
1 parent 04ba09a commit a08d9ab
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion adit_radis_shared/common/management/base/procrastinate_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def add_arguments(self, parser):
parser.add_argument(
"-q",
"--queues",
default="",
help="Comma-separated names of the queues to listen to (empty string for all queues)",
)
parser.add_argument(
Expand All @@ -38,6 +39,12 @@ def add_arguments(self, parser):
default=1,
help="Number of child processes processing the queue (defaults to number of CPUs).",
)
parser.add_argument(
"--delete-jobs",
choices=["always", "success", "never"],
default="always",
help="When to delete jobs from the queue.",
)

def run_server(self, **options):
cmd = "./manage.py procrastinate"
Expand All @@ -46,7 +53,10 @@ def run_server(self, **options):
if options["loglevel"] == "debug":
cmd += " -v 1"

cmd += " worker --delete-jobs=always"
cmd += f" worker {options["delete_jobs"]}"

if queues := options["queues"]:
cmd += f" --queues {queues}"

concurrency = options["concurrency"]
if concurrency > 1:
Expand Down

0 comments on commit a08d9ab

Please sign in to comment.