I have added a scheduler to my web2py app to be able to start tasks, 
possibly at the same time. However, I'm noticing that the when a second 
task is queued, it becomes assigned to the same worker as the first task, 
and so its status is ASSIGNED until the first one finishes. 
If I start a third task, it does get assigned to a new worker, but then the 
fourth task would get assigned to the 2nd worker again. As a result it 
seems like every other simultaneous task waits, which defeat the purpose of 
having multiple workers.

My setup:
mysql database

I have added a scheduler with a simple:

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

I use this code to auto start the Scheduler with 20 workers:

description "web2py task scheduler"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
respawn limit 8 60 # Give up if restart occurs 8 times in 60 seconds.
exec sudo -u mywebserveruser python /home/mywebserveruser /web2py/web2py.py -K 
myapp,myapp,myapp,myapp,myapp,myapp,myapp,myapp,myapp,myapp,myapp,myapp,myapp,myapp,myapp,myapp,myapp,myapp,myapp,myapp
respawn


In the default controller I start tasks with something like:
session.task_id = scheduler.queue_task(myCustomScript, 
pargs=[session.myargs], immediate=True, timeout=604800)


I have no idea what I am doing wrong so I would appreciate any suggestions.

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

Reply via email to