There are also libraries that work fine for like schedule, APScheduler, pycron
The two first have i used serval times before,Python job scheduling for humans is maybe the easiest to use.
Schedule use simpler Threading if that's needed.
The two first have i used serval times before,Python job scheduling for humans is maybe the easiest to use.
Holon Wrote:I would like to use asyncio for thatThat's maybe overkill for this task,as usually don't need 1000's task to load at same time for this.
Schedule use simpler Threading if that's needed.
import threading import time import schedule def job(): print(f"I'm running on thread {threading.current_thread()}") def run_threaded(job_func): job_thread = threading.Thread(target=job_func) job_thread.start() schedule.every(10).seconds.do(run_threaded, job) schedule.every(10).seconds.do(run_threaded, job) schedule.every(10).seconds.do(run_threaded, job) while 1: schedule.run_pending() time.sleep(1)APScheduler start separate Thread automatic with schedulers.background
apscheduler Wrote:A scheduler that runs in the background using a separate thread (start() will return immediately).