Skip to content

Commit

Permalink
Merge pull request #4115 from grossir/audio_transcribe_queue_argument
Browse files Browse the repository at this point in the history
feat(audio.transcribe): add queue argument to use with celery
  • Loading branch information
grossir committed Jun 14, 2024
2 parents 3b1e373 + 81af569 commit 6244d0f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cl/audio/management/commands/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ def handle_open_ai_transcriptions(options) -> None:
continue

valid_count += 1
transcribe_from_open_ai_api.delay(audio.pk)
transcribe_from_open_ai_api.apply_async(
args=(audio.pk,), queue=options["queue"]
)

# For parallel processing: seed RPM requests per minute
# if requests_per_minute == 0, do not sleep
Expand Down Expand Up @@ -118,6 +120,11 @@ def add_arguments(self, parser: argparse.ArgumentParser) -> None:
help="""Max number of audio files to get from the database
for processing. '--limit 0' means there is no limit. Default: 0""",
)
parser.add_argument(
"--queue",
default="batch1",
help="The celery queue where the tasks should be processed.",
)

def handle(self, *args: list[str], **options: OptionsType) -> None:
super().handle(*args, **options)
Expand Down

0 comments on commit 6244d0f

Please sign in to comment.