Are you sure it wasn't you and I discussing channels and tasklets and pickling years back, and we came to the conclusion you could detach a tasklet from the channel it was blocked on, and pickle it as is. Then unpickle it, make a new channel and attach it to that. I think it used some hacky version of the pickling protocol (__reduce__ and whatever the converse is), where you'd compose the tasklet queue and then instantiate the channel that way with tasklets being sucked in.
Cheers, Richard. On 9/5/13, Andrew Francis <[email protected]> wrote: > Hi Guys: > > This is great! Sorry about that. I am not sure why I was under that > impression? Let me dredge out pickling code examples and see what I was > doing. > > Cheers, > Andrew > > > ________________________________ > From: Richard Tew <[email protected]> > To: Andrew Francis <[email protected]>; The Stackless Python Mailing > List <[email protected]> > Cc: "[email protected]" <[email protected]> > Sent: Wednesday, September 4, 2013 2:18 PM > Subject: Re: [Stackless] Documentation of tasklet life cycle (was Re: Open > Stackless issues) > > > Tasklets blocked on channels can be pickled. > >>>> import stackless >>>> c = stackless.channel() >>>> def f(ct): > ... print "in" > ... ct.receive() > ... print "out" > ... >>>> t = stackless.tasklet(f)(c) >>>> t.run() > in >>>> import cPickle >>>> s = cPickle.dumps(t) >>>> s > "cstackless\ntasklet\np1\n(tRp2\n(I3\nNI0\n(lp3\ncstackless._wrap\nframe\np4\n(c > stackless._wrap\ncode\np5\n(I1\nI1\nI1\nI67\nS'd\\x01\\x00GH|\\x00\\x00j\\x00\\x > 00\\x83\\x00\\x00\\x01d\\x02\\x00GHd\\x00\\x00S'\np6\n(NS'in'\np7\nS'out'\np8\nt > p9\n(S'receive'\np10\ntp11\n(S'ct'\ntp12\nS'<stdin>'\np13\nS'f'\nI1\nS'\\x00\\x0 > 1\\x05\\x01\\n\\x01'\np14\n(t(ttRp15\n(tbtRp16\n(g15\nI1\nS'eval_frame_value'\np > 17\nc__builtin__\ngetattr\np18\n(c__builtin__\n__import__\np19\n(S'__main__'\n(t > (t(S''\nttRp20\nS'__dict__'\ntRp21\nI0\n(dNNI13\nI1\n(t((tcstackless\nchannel\np > 22\n(tRp23\n(I-1\nI6\n(lp24\ng2\natbttbatb." >>>> > > > On 9/5/13, Andrew Francis <[email protected]> wrote: >> Hi Anselm: >> >> ---------------------------------------------------------------------- >> >> Message: 1 >> Date: Wed, 04 Sep 2013 15:07:51 +0200 >> From: Anselm Kruis <[email protected]> >> To: [email protected] >> Subject: [Stackless] Documentation of tasklet life cycle (was Re: Open >> Stackless issues) >> Message-ID: <[email protected]> >> Content-Type: text/plain; charset="iso-8859-1"; format="flowed" >> >>>I just created a first draft of a state diagram for the tasklet life >>>cycle. It is here: >> >>>http://www.stackless.com/ticket/24#comment:11 >> >>>Any comments and suggestions are highly welcome. >> >> >> Nice work. Some comments: >> >> What is the difference between a tasklet that is not alive (i.e., not >> bound >> to a callable) and a tasklet that is not alive (but bounded to a >> callable). >> Should there be a dead state? >> >> Do you really need to distinguish between the "running" state and the >> "running in scheduler" state? Isn't the difference between stackless.run() >> and tasklet.run() a matter of when a tasklet is scheduled? >> >> Does a tasklet that is pickled or blocked on a channel require a special >> state (since a tasklet blocked on a channel cannot be pickled)? >> >> Cheers, >> Andrew _______________________________________________ Stackless mailing list [email protected] http://www.stackless.com/mailman/listinfo/stackless
