Hello everyone,<div>     I'd like to know if there is a simple way to put tasklets in relation. The idea is to be able to notify some tasklets of the death of another one so the survivor can take some actions. By looking at stackless.py from the PyPy project I didn't find anything like this. Maybe there is some way to do it with channels that I'm not aware of!</div>
<div><br></div><div>With stackless.py, tasklets are implemented on top of coroutines that have such a behaviour. When a coroutine is started, the starter is considered as the parent and if the child couroutine throws an exception, it will be forwarded to the parent. The implementation of tasklets in stackless.py catch those exceptions and just ignore them. For my Master Degree project I added an optional relationship between tasklets. First, a .throw(Exception) method was added to the coroutine class from which the tasklet class inherits. Then, the code that catches the exception thrown by a tasklet that ignored it now forwards it to the parent if it's set, wrapped within a ChildException. To create a relation between tasklets, I added a parameter to the constructor of the tasklet class. The use of dstackless here is because I made my own set of classes that override stackless ones. They are used in the same way.</div>
<div><br></div><div>c = dstackless.channel()</div><div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco">ref_task_sender = dstackless.tasklet(task_sender)(c)</p>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco">ref_task_receiver = dstackless.tasklet(task_receiver, parent = ref_task_sender)(c)</p></div><div><br></div><div>If there really isn't any way to create a relation between tasklets to forward exceptions with Stackless Python, why such a decision was made (if it was)? I'm just curious and I need to explain this in my thesis.</div>
<div><br></div><div>Thank you very much,</div><div><br></div><div>Gabriel</div><div><br>-- <br>Gabriel Lavoie<br><a href="mailto:glavoie@gmail.com">glavoie@gmail.com</a><br>
</div>