Any Heroku folks on here? It seems their system will not execute things from APScheduler labeled as cron. FYI: I'm using the free package. Using this example, the interval will run, the cron will not. Has anyone else run into this?
EDIT: Its been suggested that I specify UTC I am unsure how to do that using add_job. Any takers? Because I know this isn't currently right:
from apscheduler.schedulers.blocking import BlockingScheduler
from pytz import utc
sched = BlockingScheduler(timezone=utc)
def grabit():
print "This job is run every weekday"
def tick():
print "every 5 minutes"
sched.add_job(grabit, 'cron', day_of_week='mon-fri', hour=0, minute=13, id="get_things", replace_existing=True)
sched.add_job(tick, 'interval', minutes=5)
sched.start()
The max_instances only tells you how many concurrent jobs you can have. APScheduler has three types of triggers: date interval cron. interval and cron repeat forever, date is a one-shot on a given date.
APScheduler provides many different ways to configure the scheduler. You can use a configuration dictionary or you can pass in the options as keyword arguments. You can also instantiate the scheduler first, add jobs and configure the scheduler afterwards. This way you get maximum flexibility for any environment.
It only stops when you type Ctrl-C from your keyboard or send SIGINT to the process. This scheduler is intended to be used when APScheduler is the only task running in the process. It blocks all other code from running unless the others are running in separated threads.
You can pass the string like this:
sched = BlockingScheduler(timezone="Asia/Kolkata")
And find the string using thisL
from tzlocal import get_localzone
tz = get_localzone()
print(tz)
The object will contain the string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With