yes, it's a typo.
Regarding the latter, the excerpt is 

To enable the scheduler you must instantiate the Scheduler class in a 
model. The recommended way to enable the scheduler to your app is to create 
a model file named scheduler.py and define your function there. After the 
functions, you can put the following code into the model:

from gluon.scheduler import Scheduler
scheduler = Scheduler(db)

If your tasks are defined in a module (as opposed to a model) you may have 
to restart the workers.

The task is scheduled with

scheduler.queue_task(task_add,pvars=dict(a=1,b=2))



It's a "separate" quote, it doesn't suggest to use queue_task in the model. 
You're correct though. If you use queue_task in a model, each request will 
queue a task.


On Sunday, November 15, 2015 at 5:38:32 AM UTC+1, noam cohen wrote:
>
> Hello web2py'ers
> I have just started using web2py for a pet project I am working on and 
> like it a lot.
>
> My experience is mostly in C++ so I might ask silly questions here :)
>
> TYPO in the book:  in 
> http://web2py.com/books/default/chapter/29/04/the-core#web2py-Scheduler
>
> completed_runs = db(db.scheduler_run.run_status*=*'COMPLETED').select()
>
> I think it should be *'=='*
>
> ------------
>
> I *think* I saw in the book that the Scheduler can be initialized in a model 
> file such as
>
> models/tasks.py:s = Scheduler(....)s.queue_task(....)
>
> My understanding is that the tasks.py module is loaded every page hit 
> (verified by adding print statement), so the above code will erroneously add 
> the task waaaay too many times. Am I correct?
>
>
> Thanks
>
> Noam
>
>
>

-- 
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.

Reply via email to