SPF Rant
If you can use SPF, please do so, but you can't if you have joined the chain of fools. Detailing the chain.
I am a greybeard developer, literally. I am currently doing custom web applications and network administration for a manufacturer. I work mainly in python, but have worked with at least a dozen languages. The writings on this website are mine, and have neither been reviewed nor approved by the company for which I work.
I have long used Zope, and have recently switched to bfg, and then to pyramid.
This site is mainly about pyramid, but, I reserve the right to ramble on about anything that crosses my mind.
I can be reached as jpenny @ jpenny.im.
If you can use SPF, please do so, but you can't if you have joined the chain of fools. Detailing the chain.
First, why worry? If you have a site that has light usage and the slow job is not really slow, say under 10 seconds, and you have a patient set of users, and all the processing can occur on your Pyramid machine, then there is nothing really needed. If you are in a situation where any of these conditions are not met, then you probably need to think about how to get parts of the task out of Pyramid -- whether to save threads, to prevent timeouts, or just because the work doesn't happen there.
There are many options, but the classic method to decouple the server-side work from the Pyramid response cycle would be to use a message queue. And there are a lot of options available here. I like ZeroMQ. It has good documentation, that is even fun to read. It also has a low-level vibe to it that is really compatible with the Pyramid philosophy -- you don't get a message queue, per se, you get a set of building blocks that lets you quickly develop the kind of MQ you need.
But, there is one minor problem. The 0MQ examples pretty much all show the adaptor as a global singleton, one which has internal state. This state is used, for example to round-robin amongst service providers, if several exist. But, Pyramid really, really does not like globals. There are ways of making pseudo-globals (thread-locals), but they are not particularly pretty. So, what to do?
Answer: nothing. After experimentation, I found that the python adaptor can create a connection object, instantiate it, and make the actual connection over a LAN in a millisecond or less. That is neglible for my appication, and if I need state, I simply push it into the server.
For this particular application, the ultimate solution was phantomjs.
Source can be downloaded as rolodex.tar.gz. A demo version is running at jpenny.im:8080/. Installation instructions have not been written yet. My apologies.
I just realized that this should have been called kraken. Subby and Goss are just around the corner...
Writeup is at: http://jpenny.im/weblogin_doc/
Classically, browsers work in a strict call-response cycle. The browser makes a request and the server is responsible for making a valid response. And in web applications, the cycle looks like: browser makes a GET request. The response is a form that the user fills in. After it is filled in, the browser makes a POST request. Ideally, the server will process the form, change any stored information, and REDIRECT the browser to some page. (For more information on why the redirect is done, you can start at: http://en.wikipedia.org/wiki/Post/Redirect/Get)
But, what happens if the POST data has an error in it. Somehow the original form has to be "re-painted" and sent back to the user. Users get really cranky if the have to type in the whole thing again! What is a good way to do this in pyramid?
More...But, the number of technologies involved can be staggering. A good web developer will have a working knowledge of HTTP; an intimate knowledge of HTML, including "HTML5"; will be able to work with CSS; will have a working knowledge of JavaScript, and probably better knowledge of some JavaScript libraries; will be able to work with persistence engines, either directly or using some sort of adapter library; will probably need to know at least one server framework well; and will need to know whatever languages the server framework uses. In addition, some domain specific languages, such as templating languages will probably need to be learned. And the developer will have to be able to fluently switch between all of these artifacts, as they will typically all be in use simultaneously.
More...