[web2py] Re: Scheduler: tasks are always assigned to the same running worker.

2014-12-19 Thread Pengfei Yu
Yeah, I just made it work. Since I used Apache2 to host web2py in EC2 instance, after updating the scheduler.py file, I need to restart the Apache2 server by: sudo service apache2 restart and then restart the web2py-scheduler by: sudo stop web2py-scheduler sudo start web2py-scheduler (th

[web2py] Re: Scheduler: tasks are always assigned to the same running worker.

2014-12-19 Thread Niphlod
> > In my real-word application, I used MySQL database from AWS RDS. Do you > think if it will also cause "concurrent" issue? > nope, mysql is fine with concurrency > > I see in the gist that only the gluon/scheduler.py file has been changed. > So is it fine if I only update this scheduler.

[web2py] Re: Scheduler: tasks are always assigned to the same running worker.

2014-12-19 Thread Pengfei Yu
Wow! Thanks Niphlod for your kind and efficient helps. And I appreciate your praise words to me. This is very encouraging for an amateur python-er. In my real-word application, I used MySQL database from AWS RDS. Do you think if it will also cause "concurrent" issue? I see in the gist that onl

[web2py] Re: Scheduler: tasks are always assigned to the same running worker.

2014-12-18 Thread Niphlod
ok, got it, all tests pass. PR ready at https://github.com/web2py/web2py/pull/565 In the meantime, if you want to verify the "better assignment", all you have to do is applying this to the scheduler c

[web2py] Re: Scheduler: tasks are always assigned to the same running worker.

2014-12-18 Thread Niphlod
...several minutes later ... ;-P , I got the gist of it. First of all, testing something "concurrent" with sqlite isn't properly fair. SQLite sucks at being concurrent. That being said, assignment is sub-optimal (the gist of what you're trying to point at). Clicking here and there with 3 work

[web2py] Re: Scheduler: tasks are always assigned to the same running worker.

2014-12-18 Thread Niphlod
> > > > Each time I click the link, one test task will be created. But if I click > twice, the two initiated tasks are always assigned to the same worker, and > I need to wait until one task to be completed to run the other one. I am > not sure if it is a bug or not. Is there any way to make th

[web2py] Re: Scheduler: tasks are always assigned to the same running worker.

2014-12-17 Thread Pengfei Yu
Hi Niphlod, I found a strange situation even using the "testtask". Here are two different scenarios. In the first scenario, the two test tasks can be run concurrently as in my last reply. In the second scenario, the two test tasks will be assigned to the same worker, although the worker is alr

[web2py] Re: Scheduler: tasks are always assigned to the same running worker.

2014-12-17 Thread Niphlod
ok, so it's not a problem of the "algorithm" of dispatching tasks of the scheduler . Try adding small bits of your code to the test_task to pinpoint the root cause of the original misbehaviour. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py

[web2py] Re: Scheduler: tasks are always assigned to the same running worker.

2014-12-16 Thread Pengfei Yu
Hi Niphlod, Thanks for your reply! The problem is the 5681 is taking the task 1 and it is RUNNING (See the worker stats of worker 1). But at the same time, the task is still assigned to 5681, but not two other ACTIVE workers, 5685 and 5690. I previously thought the reason might be in the status

[web2py] Re: Scheduler: tasks are always assigned to the same running worker.

2014-12-16 Thread Niphlod
Uhm, really strange. Keep things simple to reproduce: queue tasks that are something like import time def testtask(): time.sleep(60) return 1 and see if the behaviour is reproducible. Here I don't see anything wrong: 5861 is ACTIVE (meaning there's nothing actively running on it, or i