I have a python schedule re-task, as shown below, which should getMyStock () run every 3 minutes in startMonitor ():
from stocktrace.util import settings import time, os, sys, sched schedule = sched.scheduler(time.time, time.sleep) def periodic(scheduler, interval, action, actionargs=()): scheduler.enter(interval, 1, periodic, (scheduler, interval, action, actionargs)) action(*actionargs) def startMonitor(): from stocktrace.parse.sinaparser import getMyStock periodic(schedule, settings.POLLING_INTERVAL, getMyStock) schedule.run( )
Questions:
1. How can I cancel or stop the schedule when some user event arrives?
2. Is there any other python module for better re-planning? Also like java quartz?
source share