import os

import redis

r = redis.from_url(f"redis://:{os.environ.get('REDIS_PASSWORD','')}@{os.environ['REDIS_HOST']}:{os.environ['REDIS_PORT']}/0")
for q in ["ingestion","parsing","extraction","aggregation","recommendation","lake_publish","broker_orders"]:
    key = f"stonks:queue:{q}"
    depth = r.llen(key)
    if depth > 0:
        r.delete(key)
        print(f"  Flushed {key}: {depth} jobs")
    else:
        print(f"  {key}: empty")
