I have an APScheduler application in a Flask application that dispatches events at regular intervals.
Now I need to โupdateโ all tasks, because just start them now if they do not start without touching a certain interval.
I'v tried calling job.pause (), then job.resume () and nothing, and using the job. reschedule_job (...) will call it, but also change the interval ... which I don't want.
My actual code is below:
cron = GeventScheduler(daemon=True) # Explicitly kick off the background thread cron.start() cron.add_job(_job_time, 'interval', seconds=5, id='_job_time') cron.add_job(_job_forecast, 'interval', hours=1, id='_job_forecast_01') @app.route("/refresh") def refresh(): refreshed = [] for job in cron.get_jobs(): job.pause() job.resume() refreshed.append(job.id) return json.dumps( {'number': len(cron.get_jobs()), 'list': refreshed} )
source share