On 5/29/07, alecf <[EMAIL PROTECTED]> wrote:
> I'm interested in serving up my pylons app under Stackless Python -
> Stackless is more or less single-threaded so the model is somewhat
> like Twisted but without all the deferreds. Instead of threads, there
> are tasklets which participate in kind of a cooperative parallelism -
> as soon as one tasklet blocks, another tasklet is allowed to run until
> it blocks, and so forth.

Ah, stackless ;)

> Since this is single-threaded, I have some concerns is with these
> 'global' objects that Pylons provides.. c, h, etc...
>
> These are normally thread-local storage right? Does pylons provide any
> capability to either:
> - provide a container so I can manage the thread-localness of them (I
> could store them in a tasklet-local storage)
> - provide a way to access them from environ rather than as a global?
> (then I could access them on a per-request basis, independent of what
> tasklet/thread they're run on)
> - avoid the use of them entirely?

I suspect you're going to need to override some code to do things "the
stackless way" using the stackless notion of thread local storage.
Strangely enough, this same thing happened to me using a proprietary
version of stackless in my framework Aquarium.

If I were in your shoes, I might spend some time figuring out
different ways to monkey patch things (either by making tasklets
masquerade as threads or by swapping in some code into Paste).  Just
look at the code for what Paste is actually doing and figure out what
you wish it were doing and see if you can do some magic to make it
work.

> really I'd prefer that these things were just explicit in the request
> because otherwise it really ties pylons down to a multi-threaded or
> forked model.

In Aquarium I made the design decision that you had to get everything
from the ctx for exactly this reason.  That's why Aquarium adapted to
stackless so easily.  However, the stacked object proxies are
syntactically convenient--the cost is that they're tied to the normal
Python threading API.

> Part of the reason I'm using stackless is that I can
> safely fire off multiple 'parallel' tasklets during a request which
> makes management of simultaneous database requests dirt-simple.

Yep.

>  But maybe I'm missing something? Anyone have any ideas here?

You're a smart guy ;)  You'll figure it out ;)  Tell us how it goes.

Best Regards,
-jj

-- 
http://jjinux.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to