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
already running the first task.
*Scenario 1:*
In the default controler, I use:
def index():
scheduler.queue_task("testtask",timeout=1000)
db.commit()
time.sleep(10)
scheduler.queue_task("testtask",timeout=1000)
db.commit()
return dict()
Then when I access the index page, two test tasks are created one-by-one
and are assigned to different active workers. There is overlap in their
running periods.
Scenario 2:
If I create another function in default controller to initiate one task:
def index():
return dict()
def TestTask():
scheduler.queue_task("testtask",timeout=1000)
db.commit()
redirect(URL("index"))
And in the view, index.html page, I create a link to call "TestTask()":
<h4>Test_task:</h4>
<a href="{{=URL('TestTask')}}">Click to start</a>
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 the scheduler to
assign tasks the same way as scenario 1 in the case of scenario 2?
I tried to remove and include "db.commit()" for both scenarios, and the
results do not change.
Thanks!
On Wednesday, December 17, 2014 8:12:37 AM UTC-5, Niphlod wrote:
>
> 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 (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.