1. schedule pip install schedule python import schedule import time def job(): print("I'm running...") while True: schedule.run_pending() time.sleep(1) 2. apscheduler pip install apscheduler python from apscheduler.schedulers.blocking import BlockingScheduler def job(): print("I'm running...") scheduler = BlockingScheduler() scheduler.start() 3. celery pip install celery python from celery import Celery @app.task def add(x, y): return x + y python from celery import Celery


上一篇:
下一篇:
切换中文