[Stackless] About Pickling Stackless with ZODB

Andrew Francis andrewfr_ice at yahoo.com
Thu Sep 20 15:12:17 CEST 2007


Hi Johan and Colleagues:

--- Johan Carlsson <johanc at easypublisher.com> wrote:

> Thanks for the input Andrew :-D

No problem. The more we pool information, the further
ahead we get.

> Pickling a channel, will also pickle any tasklets
> currently blocked on it.

You are right. However the problem I wish to solve is
pickling specific tasklets. In turn, these tasklets
can be garbage collected.

>But sometimes you just want to pickle the channel
with >only some of those tasklets still blocked on it,
or >perhaps, tasklets you isolate from the channel on
their own. You can do this by using
> __reduce__ and __setstate__.
> """

If you look at the sample code (ProcessChannel1), you
will see that under the hood I use __reduce__ and
__setstate__. I am trying to come up with a way to
shield the underlying complexities (from myself and
other users). However the API isn't general. For
instance, for detach, perhaps should return the state?
This way, the implementor can better choose how the
state is actually stored.

You raise valid points like sometimes one wishes to
detach a specific tasklet. When I wrote
ProcessChannel, each of my tasklets were assigned a
channel. I should add a detachTasklet(self, tasklet)
method to make the interface more general.

Again, good interfaces are hard to write. The more we
play with APIs and techniques, the more we learn and
the better we can hone a good interface. 

> I think this is where I'm currently having problems,
> I think I need to reattach tasklets somehow. As of
>now I pickel the tasklets twice, once in the
> tasklet storeage and once for any channel that has a
>blocking tasklet.

I thought the reference counting would take care of
the double storing. I need to read up more on pickling
to confirm.

> Thanks again mate, I'll keep you all updated.

Please do. I am really interested in coming up with an
easy-to-use approach to pickling.

Cheers,
Andrew


       
____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.
http://smallbusiness.yahoo.com/webhosting 




More information about the Stackless mailing list