Blog
Deferreds En Masse
Part 18: Deferreds En Masse
This continues the introduction started in the first part. You can find an index to the entire series.
Introduction
In the last Part we learned a new way of structuring sequential asynchronous callbacks using a generator. Thus, including deferreds, we now have two techniques for chaining asynchronous operations together.
Sometimes, though, we want to run a group of asynchronous operations in “parallel”. Since Twisted is single-threaded they won’t really run concurrently, but the point is we want to use asynchronous I/O to work on a group of tasks as fast as possible. Our poetry clients, for example, download poems from multiple servers at the same time, rather than one server after another. That was the whole point of using Twisted for getting poetry, after all.
Just Another Way to Spell "Callback"
Part 17: Just Another Way to Spell “Callback”
This continues the introduction started in the first part. You can find an index to the entire series.
Introduction
In this Part we’re going to return to the subject of callbacks. We’ll introduce another technique for writing callbacks in Twisted that uses generators. We’ll show how the technique works and contrast it with using “pure” Deferreds. Finally we’ll rewrite one of our poetry clients using this technique. But first let’s review how generators work so we can see why they are a candidate for creating callbacks.
Read more: Just Another Way to Spell "Callback" → · 19 comments
Book: Blood of the Liberals
Site reorganization
Today I made my blog my main website, since the old one was getting kind of crufty. I moved the stuff I wanted to keep into Wordpress, including my collection of links to programmer’s editors. The old /blog URLs will continue to work.
Book: The Autumn of the Middle Ages
3-D Shmee-D
I watched a 1-D film yesterday. Good acting, but I thought the plot was too linear.
Book: Mohammed and Charlemagne
Twisted Daemonologie
Part 16: Twisted Daemonologie
This continues the introduction started in the first part. You can find an index to the entire series.
Introduction
The servers we have written so far have just run in a terminal window, with output going to the screen via print statements. This works alright for development, but it’s hardly a way to deploy services in production. A well-behaved production server ought to:
- Run as a daemon process, unconnected with any terminal or user session. You don’t want a service to shut down just because the administrator logs out.
- Send debugging and error output to a set of rotated log files, or to the syslog service.
- Drop excessive privileges, e.g., switching to a lower-privileged user before running.
- Record its pid in a file so that the administrator can easily send signals to the daemon.
We can get all of those features using the twistd script provided by Twisted. But first we’ll have to change our code a bit.




