Skip to content

Commit

Permalink
Add queues names to yml
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-piles committed Sep 23, 2024
1 parent 7c43628 commit 91f5302
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/QueueProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ def process(message):

service_config = ServiceConfig()
logger = service_config.get_logger("redis_tasks")
queues_names = QUEUES_NAMES.split(" ")
queue_processor = QueueProcessor(
service_config.redis_host, service_config.redis_port, queues_names, logger
service_config.redis_host,
service_config.redis_port,
service_config.queues_names,
logger,
)
queue_processor.start(process)
3 changes: 1 addition & 2 deletions src/ServiceConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
PDF_PROCESSED_PATH = f"{DATA_PATH}/processed_pdfs"
PDF_FAILED = f"{DATA_PATH}/failed_pdfs"

QUEUES_NAMES = os.environ.get("QUEUES_NAMES", "ocr")


class ServiceConfig:
def __init__(self):
Expand Down Expand Up @@ -45,6 +43,7 @@ def __init__(self):
"service_port", default_service_port
)
self.service_url = f"http://{self.service_host}:{self.service_port}"
self.queues_names = self.get_parameter_from_yml("queues_names", "ocr").split()

def get_parameter_from_yml(self, parameter_name: str, default: any):
if parameter_name in self.config_from_yml:
Expand Down

0 comments on commit 91f5302

Please sign in to comment.