Skip to content
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

26 lines (19 sloc) 720 Bytes
Demonstrates how to use the gevent compatible scheduler to schedule a job that executes on 3 second
from datetime import datetime
import os
from apscheduler.schedulers.gevent import GeventScheduler
def tick():
print('Tick! The time is: %s' %
if __name__ == '__main__':
scheduler = GeventScheduler()
scheduler.add_job(tick, 'interval', seconds=3)
g = scheduler.start() # g is the greenlet that runs the scheduler loop
print('Press Ctrl+{0} to exit'.format('Break' if == 'nt' else 'C'))
# Execution will block here until Ctrl+C (Ctrl+Break on Windows) is pressed.
except (KeyboardInterrupt, SystemExit):
You can’t perform that action at this time.