36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
from apscheduler.executors.pool import ThreadPoolExecutor, ProcessPoolExecutor
|
|
from apscheduler.schedulers.blocking import BlockingScheduler
|
|
|
|
from src.check_results import check_results
|
|
|
|
|
|
def check_results_job():
|
|
check_results()
|
|
|
|
|
|
def start_check_results_job(sched):
|
|
# sched.add_job(start_book_appointment, 'cron', day_of_week='mon-sat', hour='10',
|
|
# minute='30',
|
|
# misfire_grace_time=10,
|
|
# second='0', timezone='Europe/Paris', max_instances=1)
|
|
sched.add_job(check_results, 'cron', day_of_week='mon-sat', hour='20',
|
|
minute='55',
|
|
misfire_grace_time=10,
|
|
second='0', timezone='Europe/Paris', max_instances=1, args=[True])
|
|
|
|
|
|
def config_and_start_jobs():
|
|
executors = {
|
|
'default': ThreadPoolExecutor(30),
|
|
'processpool': ProcessPoolExecutor(12)
|
|
}
|
|
sched = BlockingScheduler(executors=executors)
|
|
# start_waiting_sms_job(sched)
|
|
start_check_results_job(sched)
|
|
sched.print_jobs()
|
|
sched.start()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
config_and_start_jobs()
|