问题
I am using apscheduler with a persistent job store through sqlalchemy in a flask application. flask-sqlalchemy module is being used.
Jobs without triggers and a persistent job store are executing. However, with cron jobs, the 'next_run_time' is always updated but the job does not execute. In case of misfire, I want the job to only run once.
## relevant global config variables for flask app
SCHEDULER_EXECUTORS = {
'default': {'type': 'threadpool', 'max_workers': 20}
}
SCHEDULER_JOB_DEFAULTS = {
'coalesce': True,
'max_instances': 1
}
## add scheduled job
app.config['JOBS'].append({
'id': '{job_id}',
'replace_existing' : True,
'func': '{module_to_kickoff}:{function}',
'jobstore': 'default',
'trigger': 'cron',
#'misfire_grace_time': 79200, # 22 hours
'day': '*', 'hour': 1, 'minute': 0
})
来源:https://stackoverflow.com/questions/54064033/apscheduler-cron-job-is-not-executing