I'm trying to stop the apscheduler from running on by removing the job
and shutting it down completely!
None of them is working, my function expire_data
still gets triggered
def process_bin(value):
print "Stored:",pastebin.value
print "Will expire in",pastebin_duration.value,"seconds!"
if pastebin_duration>=0:
scheduler = BlockingScheduler()
job=scheduler.add_job(expire_data, 'interval', seconds=5)
scheduler.start()
job.remove()
scheduler.shutdown()
def expire_data():
print "Delete data!"
How can I stop it?
Question: I'm trying to stop the
apscheduler
from running
You are using a BlockingScheduler
, therefore you can't.
APScheduler BlockingScheduler
BlockingScheduler is the simplest possible scheduler.
It runs in the foreground, so when you call start(), the call never returns.
Read about Choosing the right scheduler