I'm using APScheduler as BackgroundScheduler in my app.
main.py
scheduler = BackgroundScheduler()
scheduler.add_job(change_store_status, trigger="interval", hours=23)
scheduler.start()
tasks.py
from main import scheduler
def create_schedule():
scheduler.print_jobs()
scheduler.add_job(hello, trigger="interval", seconds=2)
scheduler.print_jobs()
Print like
Jobstore default:
change_store_status (trigger: interval[23:00:00], next run at: 2016-05-17 14:53:07 ICT)
Jobstore default:
hello (trigger: interval[0:00:02], next run at: 2016-05-16 15:46:26 ICT)
change_store_status (trigger: interval[23:00:00], next run at: 2016-05-17 14:53:07 ICT)
That mean job is added successfully but it not actual run. How to make it run. I tried add scheduler.wakeup()
but it not work.
I found the problem is APScheduler.BackgroundScheduler
thread. And running inside uWSGI make it failed. I tried enable uWSGI threads but it's still not working.
I found the problem is APScheduler.BackgroundScheduler thread. And running inside uWSGI make it failed. I tried enable uWSGI threads but it's still not working.