I have a requirement where I need to run a task for every 5 seconds, but only between specific times (like between 1:30 and 2:30 tomorrow).

I looked at celery, but a normal task cannot be executed repeatedly in celery and the periodic tasks cannot be dynamically scheduled.

I also looked at APScheduler, but that doesn't support running it as a 'daemon' and scheduling tasks from outside.

Any idea what I could use to make this happen?

Edit: Should have mentioned this earlier, I need to do this during a web request, like a background task.