Closed radurevutchi closed 3 months ago
can you provide a minimal script for reproduction?
main.py
from fastapi import FastAPI
from saq.web.starlette import saq_web
from app.saq.saq import queue as saq_queue
app = FastAPI()
# Mount background SAQ scheduler
app.mount("/scheduler", saq_web("/scheduler", queues=[saq_queue]))
saq.py
from saq import CronJob, Queue
from saq.types import Context
def update_products_daily(ctx: Context):
print("Updated")
cron_jobs = [
CronJob(update_products_daily, cron="* * * * *"), # Every minute
]
queue = Queue.from_url("REDIS_URL")
settings = {"queue": queue, "functions": [], "concurrency": 10, "cron_jobs": cron_jobs}
Just need to start your own Redis instance and run uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
to start up FastAPI. I run saq with saq app.saq.saq.settings
Go to http://localhost:8000/scheduler/queues/default/jobs/cron:update_products_daily
and you should see the same thing.
Is this a separate css library I need to install? Not to familiar with frontend
Getting
404 not found
when clicking on one of my tasks in the web UI. Can't find any documentation on this. My setup follows the tutorial code exactly. I'm hosting in my own web service (aka not pass in the--web
flag).# Mount background SAQ scheduler app.mount("/scheduler", saq_web("/scheduler", queues=[saq_queue]))