Skip to content
Snippets Groups Projects
Commit c8ffda6c authored by Marcin Wątroba's avatar Marcin Wątroba
Browse files

download_dataset command

parent 90e06ab8
Branches
...@@ -23,7 +23,7 @@ def ack_message(channel, delivery_tag): ...@@ -23,7 +23,7 @@ def ack_message(channel, delivery_tag):
pass pass
def process_queue(queue_name: str, process_message: Callable[[bytes], None]): def process_queue(queue_name: str, process_message: Callable[[bytes], None], prefetch_count: int = 1):
def do_work(connection, channel, delivery_tag, body): def do_work(connection, channel, delivery_tag, body):
process_message(body) process_message(body)
cb = functools.partial(ack_message, channel, delivery_tag) cb = functools.partial(ack_message, channel, delivery_tag)
...@@ -40,7 +40,7 @@ def process_queue(queue_name: str, process_message: Callable[[bytes], None]): ...@@ -40,7 +40,7 @@ def process_queue(queue_name: str, process_message: Callable[[bytes], None]):
parameters = pika.URLParameters(_RABBIT_URL) parameters = pika.URLParameters(_RABBIT_URL)
connection = pika.BlockingConnection(parameters) connection = pika.BlockingConnection(parameters)
channel = connection.channel() channel = connection.channel()
channel.basic_qos(prefetch_count=1) channel.basic_qos(prefetch_count=prefetch_count)
threads = [] threads = []
on_message_callback = functools.partial(on_message, args=(connection, threads)) on_message_callback = functools.partial(on_message, args=(connection, threads))
......
import argparse
import json import json
from new_experiment.pipeline.pipeline_process_flair_upos import run_flair_upos_multi_pipeline from new_experiment.pipeline.pipeline_process_flair_upos import run_flair_upos_multi_pipeline
...@@ -37,4 +38,8 @@ def process_message(body: bytes): ...@@ -37,4 +38,8 @@ def process_message(body: bytes):
if __name__ == '__main__': if __name__ == '__main__':
process_queue('asr_benchmark_experiments', process_message) parser = argparse.ArgumentParser()
parser.add_argument("--prefetch_count")
args = parser.parse_args()
process_queue('asr_benchmark_experiments', process_message,
1 if args.prefetch_count in [None, ''] else int(args.prefetch_count))
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment