Thanks Richard.<br>I understand what you have explained.<br><br>I Put the problem in this way:<br>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.<br>
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. <br>
<br><br>--Piyush<br> <br><br><div class="gmail_quote">On Wed, Feb 29, 2012 at 1:04 PM, Richard Tew <span dir="ltr"><<a href="mailto:richard.m.tew@gmail.com">richard.m.tew@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im">On Wed, Feb 29, 2012 at 8:00 PM, piyush singhai<br>
<<a href="mailto:singhai.piyush@gmail.com">singhai.piyush@gmail.com</a>> wrote:<br>
> Some of my tasklets are blocked because of which whole system is blocked.<br>
> There is a option of timeout in run method but it is not time it is<br>
> depending on number of instruction, how Can i specify the time.<br>
<br>
</div>It is impossible to know what your problem is from what you have said<br>
above.  There is no timeout for the scheduler, if your tasklets are<br>
blocking the scheduler and preventing other tasklets from running,<br>
then you need to take a different approach.<br>
<br>
The recommended approach is to pump the scheduler:<br>
1) When a tasklet needs to block, do it in an asynchronous manner.<br>
Post the asynchronous operation and block the tasklet on a channel<br>
until the callback comes to awaken it from the channel back into the<br>
scheduler.<br>
2) Your main loop will continuously run the scheduler.  Most of the<br>
time, it will have no tasklets to run because they will be out of the<br>
scheduler blocked on channels waiting for IO to complete.<br>
<br>
Here's a simple implementation of this approach:<br>
<a href="http://code.google.com/p/stacklessexamples/source/browse/trunk/examples/scheduleAlternative.py" target="_blank">http://code.google.com/p/stacklessexamples/source/browse/trunk/examples/scheduleAlternative.py</a><br>

<br>
Note that using asynchronous IO is something you need to take care of yourself.<br>
<br>
Cheers,<br>
Richard.<br>
<br>
_______________________________________________<br>
Stackless mailing list<br>
<a href="mailto:Stackless@stackless.com">Stackless@stackless.com</a><br>
<a href="http://www.stackless.com/mailman/listinfo/stackless" target="_blank">http://www.stackless.com/mailman/listinfo/stackless</a><br>
</blockquote></div><br>