Dipan04's picture
Deploy Invoice Digitization Agent
8a859a8
raw
history blame
814 Bytes
import os
import sys
from pathlib import Path
from redis import Redis
from rq import Worker, Queue, Connection
# Add parent directory to path
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
# Import job processor
from backend.worker.job_processor import process_job
# Redis connection
REDIS_HOST = os.getenv('REDIS_HOST', 'redis')
REDIS_PORT = int(os.getenv('REDIS_PORT', 6379))
REDIS_DB = int(os.getenv('REDIS_DB', 0))
QUEUE_NAME = os.getenv('REDIS_QUEUE_NAME', 'invoice_ingest')
redis_conn = Redis(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB)
if __name__ == '__main__':
print(f"🚀 Starting worker for queue: {QUEUE_NAME}")
print(f"📡 Redis: {REDIS_HOST}:{REDIS_PORT}/{REDIS_DB}")
with Connection(redis_conn):
worker = Worker([QUEUE_NAME])
worker.work()