When a task runs, it runs in the same environment as a controller, which means it runs your models. So, if you queue the tasks in a model, then whenever a task runs, it will end up queuing another version of itself.
If you want to set these tasks to run repeatedly, then you only need to queue them once -- so either do it via appadmin, or do it via a controller action that you call only once. Anthony On Wednesday, April 2, 2014 1:17:20 AM UTC-4, Kiran Subbaraman wrote: > Anthony, > Thanks for the explanation, helps me understand scheduler better. I will > try the task configuration now. > This is my scheduler and task definition: > sched_db = DAL(...postgres...) > scheduler = Scheduler(heartbeat=20) > # Task A > scheduler.queue_task(functionc) > # Task B > scheduler.queue_task(functionb) > # Task C > scheduler.queue_task(functiona) > > The function* are regular functions to send emails and such, representing > tasks A, B, C. I haven't set any of the task configuration parameters; > working with defaults. > > What I couldn't understand was the timestamps at which the tasks appear on > the debug log. They seem to be running every second or less than a second. > > ________________________________________ > Kiran Subbaramanhttp://subbaraman.wordpress.com/about/ > > On Wed, 02-04-2014 1:26 AM, Anthony wrote: > > Can you provide more detail regarding how you added the tasks and to > what values you set the relevant parameters. The heartbeat does not > determine the frequency of tasks but the frequency with which the scheduler > checks the task queue for the arrival of new tasks to assign to workers. To > set the frequency with which to repeat a recurring task, use the "period" > argument (possibly in conjunction with "prevent_drift"). If you want a task > to run approximately every minute (but do not need exactly 60 per hour), > set repeats=0 (i.e., unlimited repeates) and set period=60 and > prevent_drift=False (which are the default values for both). For a task > that should run exactly once every 24 hours (at the same time), set > period=60*60*24 and prevent_drift=True. > > Anthony > > On Tuesday, April 1, 2014 2:29:19 PM UTC-4, Kiran Subbaraman wrote: > > Hello, > I have setup the scheduler to execute on three different tasks > Task A, B, and C > Also, have setup the scheduler's heartbeat to 20seconds > There are no further specific configurations. It works well. > > Have turned on the debug log, and notice that there is a constant output > from the tasks there: > 2014-04-01 23:36:16,642 - web2py.app.myapp - DEBUG - result: "Done: > Task A" > 2014-04-01 23:36:17,407 - web2py.app.myapp - DEBUG - new task > report:COMPLETED > 2014-04-01 23:36:17,408 - web2py.app.myapp - DEBUG - result: "Done: > Task B" > 2014-04-01 23:36:18,180 - web2py.app.myapp - DEBUG - new task > report:COMPLETED > 2014-04-01 23:36:18,180 - web2py.app.myapp - DEBUG - result: "Done: > Task C" > 2014-04-01 23:36:18,944 - web2py.app.myapp - DEBUG - new task > report:COMPLETED > 2014-04-01 23:36:18,944 - web2py.app.myapp - DEBUG - result: "Done: > Task A" > 2014-04-01 23:36:19,719 - web2py.app.myapp - DEBUG - new task > report:COMPLETED > 2014-04-01 23:36:19,719 - web2py.app.myapp - DEBUG - result: "Done: > Task C" > 2014-04-01 23:36:20,486 - web2py.app.myapp - DEBUG - new task > report:COMPLETED > 2014-04-01 23:36:20,486 - web2py.app.myapp - DEBUG - result: "Done: > Task A" > 2014-04-01 23:36:21,260 - web2py.app.myapp - DEBUG - new task > report:COMPLETED > 2014-04-01 23:36:21,260 - web2py.app.myapp - DEBUG - result: "Done: > Task B" > 2014-04-01 23:36:22,045 - web2py.app.myapp - DEBUG - new task > report:COMPLETED > 2014-04-01 23:36:22,045 - web2py.app.myapp - DEBUG - result: "Done: > Task C" > 2014-04-01 23:36:22,819 - web2py.app.myapp - DEBUG - new task > report:COMPLETED > 2014-04-01 23:36:22,819 - web2py.app.myapp - DEBUG - result: "Done: > Task A" > 2014-04-01 23:36:23,598 - web2py.app.myapp - DEBUG - new task > report:COMPLETED > 2014-04-01 23:36:23,598 - web2py.app.myapp - DEBUG - result: "Done: > Task B" > 2014<span > > ... -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.