you're missing a BIIIIG point.
Either you need to queue a task as a result of some user action (i.e. send
a reminder, calculate/aggregate/refresh some data, etc) --> usually it's a
one-time-only activity, in which case, the following "pattern" applies
#models\scheduler.py
from gluon.scheduler import Scheduler
def demo1():
db.asdf.insert(asdf = 'asdf')
db.commit()
mysched = Scheduler(db, tasks = dict(demo1 = demo1) )
#controllers\a_controller.py
def an_action():
......
#we need to schedule a background task
mysched.queue_task('demo1')
Or you need a single task that repeats itself every once in a while
(usually repeating tasks are "cron-like" and "maintenance-related").
In that case, you define the scheduler in models\scheduler.py, and you (as
the admin-developer-god of the web application) queue a task in appadmin.
Or you prepare a controller just for the occasion, that can only be
accessed by you and run once (so you get only a SINGLE record in the
scheduler_task table).
Now, back to your goal. If you want a single record to be added to the asdf
table every day, you need a SINGLE task that has
repeats --> 0
period --> 60*60*24
prevent_drift --> True (if you care for "at the same time every day")
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.