[Stackless] tasklet time out

piyush singhai singhai.piyush at gmail.com
Wed Feb 29 11:06:15 CET 2012

Thanks Richard.
I understand what you have explained.

I Put the problem in this way:
We have a main tasklet that spawn multiple tasklets. Now each tasklet have
to execute  some python script. We have handled all IO operation including
API and DB operation in Asynchronous manner. So that will not the issue.
Now suppose one of the tasklet stuck in while true loop or infinite loop
because of the code bug you can say. Then no other tasklet will get the
turn to execute. I want to avoid this  scenario. I am trying to do using
stackless.run(timeout) but this timeout is number of instruction.


On Wed, Feb 29, 2012 at 1:04 PM, Richard Tew <richard.m.tew at gmail.com>wrote:

> On Wed, Feb 29, 2012 at 8:00 PM, piyush singhai
> <singhai.piyush at gmail.com> wrote:
> > Some of my tasklets are blocked because of which whole system is blocked.
> > There is a option of timeout in run method but it is not time it is
> > depending on number of instruction, how Can i specify the time.
> It is impossible to know what your problem is from what you have said
> above.  There is no timeout for the scheduler, if your tasklets are
> blocking the scheduler and preventing other tasklets from running,
> then you need to take a different approach.
> The recommended approach is to pump the scheduler:
> 1) When a tasklet needs to block, do it in an asynchronous manner.
> Post the asynchronous operation and block the tasklet on a channel
> until the callback comes to awaken it from the channel back into the
> scheduler.
> 2) Your main loop will continuously run the scheduler.  Most of the
> time, it will have no tasklets to run because they will be out of the
> scheduler blocked on channels waiting for IO to complete.
> Here's a simple implementation of this approach:
> http://code.google.com/p/stacklessexamples/source/browse/trunk/examples/scheduleAlternative.py
> Note that using asynchronous IO is something you need to take care of
> yourself.
> Cheers,
> Richard.
> _______________________________________________
> Stackless mailing list
> Stackless at stackless.com
> http://www.stackless.com/mailman/listinfo/stackless
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20120229/9b5185ed/attachment.html>

More information about the Stackless mailing list