[Stackless] Stackless Python problem. Help respectfully

Andrew Francis andrewfr_ice at yahoo.com
Sun Jul 16 21:14:30 CEST 2006


Hello Kai:

Bob Ippolito writes:

>What you want is not going to happen. Neither method
>is actually  stackless, they both block all
>execution on socket IO. Since there  
>aren't even any schedule calls in any of the urllib
>stack, it won't  even try and do anything at all >in
"parallel".

Kai, I briefly looked at your code. You have to keep
in mind that Stackless blocks on IO. This means you
have to rely on asynchronous IO.

~

>You need networking code that understands stackless.
>Such a package doesn't publicly exist to my
>knowledge. You can however do this task  
>in Twisted, and you would get the benefits of
>parallel requests.

and Grant Olson writes:

>There is a low-level stackless socket on the
>stackless website.  You would have to manually build
>the HTTP stuff on top of that, so a rewrite might not
>be worth it:

Kai, there is no need to roll your own HTTP stuff. I
have used Twisted deferred called and task loops with
success. My WS-BPEL processor prototype is both
calling and processing web services. This is rather
extreme. I use the later to get around an underlying
call to accept() that would block the system. Thanks
to Bob for pointing this out. I have to admit that I
still not quite sure of all the issues involved (i.e.,
I seem to lose calls if I make calls too fast but I
was stress testing the system) when I have a callback
make a call to stackless.schedule(). However it seems
to solve a pesky problem.

the core code in Twisted looks like this.

postRequest = client.getPage(address, \
                             method = 'POST', \
                             headers = self.headers,\
                             postdata = self.body)

postRequest.addCallback(self.__handleResponse__).addErrback(self.__handleError__)
    

Since I want callbacks to do a minimum of processing,
I create a connection object and pass it channel to
communicate with my processor that does the work.

Cheers,
Andrew


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list