[Stackless] Stackless with ZODB
Christian Tismer
tismer at stackless.com
Tue Sep 18 21:22:49 CEST 2007
Johan Carlsson wrote:
> Ok did some more testing...
>
> I've god the latest standalond version of ZODB and I'm using the
> standard config for a FileStorage and the following function:
>
> def test_task(ch, data="No data"):
> i=1
> while 1:
> print i, "test_task", data
> data = ch.receive()
> i=i+1
>
> root is the root ZODB mapping object.
>
> root['talk'] = stackless.channel()
> root['task']=stackless.tasklet(test_task)(root['talk'], "first data")
> commit()
>
> Now running root['talk'].send("hello") works fine the counter counts up.
>
> Because tasklets and channels isn't Persistent-aware they need to be
> rewritten, so after calling send on the channel for a couple of whiles
> I do this:
>
> root['task'] = root['task']
> root['talk'] = root['talk']
> commit()
...
Interesting. I have played around with some external functions
to allow pickling of a zope execution. But as I remember, it was
a lot of hacking to avoid pickling of certain zope structures.
Maybe I can dig this up.
I ended up with a pickle that could be restarted, displaying
a counter on a web page.
I think I had to make sure that the tasklet was really removed
between responses. No idea if there is much future in this...
ciao - chris
--
Christian Tismer :^) <mailto:tismer at stackless.com>
tismerysoft GmbH : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56 mobile +49 173 24 18 776 fax +49 30 80 90 57 05
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
More information about the Stackless
mailing list