tobymao / saq

Simple Async Queues
https://saq-py.readthedocs.io/en/latest/
MIT License
532 stars 37 forks source link

404 not found (task in web view) #125

Closed radurevutchi closed 3 months ago

radurevutchi commented 3 months ago

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]))

Screenshot 2024-06-10 at 02 10 04 Screenshot 2024-06-10 at 02 10 59
tobymao commented 3 months ago

can you provide a minimal script for reproduction?

radurevutchi commented 3 months ago

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.

radurevutchi commented 3 months ago
Screenshot 2024-06-10 at 17 59 48

Is this a separate css library I need to install? Not to familiar with frontend