January 31st, 2009 § § permalink
Next up in the GBLOSTR (great big list of stuff to review) is the Circuits library by James Mills (here and here) I’m familiar only with James Mills’ posts on python-list, but more recently, I know he’s been working on getting some level of multiprocessing into circuits — circuits was already on my research list, but I bumped it up on the queue because we started chatting.
Let me state this: these are slightly cleaned up versions of my notes as I am learning these modules — some of them have higher learning curves for me than others.
Circuits is, well — an event based “framework” (again, note the small f) based around the concept of Components (big C!) consuming/reacting and in turn generating events — all asynchronously.
James’ goals seem pretty simple — build something with no external dependencies, that’s compact (I should say, the core.py is < 500 lines) and that makes it easy to build scalable messaging based (event based) systems. Did he succeed — don’t know! Let’s dig in.
» Read the rest of this entry «
Next up in the GBLOSTR (great big list of stuff to review) is the Circuits library by James Mills (here and here) I'm familiar only with James Mills' posts on python-list, but more recently, I know he's been working on getting some level of multiprocessing into circuits - circuits was already on my ...
January 29th, 2009 § § permalink
Note:This is the first post in what I hope will be a series leading up to my concurrency/distributed systems talk at PyCon. I’m steadily working through experimenting with and learning the various frameworks/libraries in the python ecosystem.
I reserve the right (and probably will) to revise these entries based on feedback from people (mainly the author(s) of said tool(s)). I will also add additional bits and pieces as I learn and explore more. Code and examples will be checked into my pycon 2009 bitbucket site here/Note
For awhile now, I’ve been meaning to dig into Kamaelia but was largely put off by what I tend to call the “twisted effect”. What this means is that when I go looking for libraries and small components, I go looking for a library — not a “solution”. I also worry about the “once you go in, you must follow this paradigm” effect. I’m not going to say that these feeling continue to be founded, or are completely rational — after all, I am digging into it, yes? It’s the thought that once you adopt the “one true way of doing things” you’re trapped in that solution/framework “forever” — ironically, I love Django for it’s “conceptual integrity” and full-stack approach. No, I don’t understand me either.
» Read the rest of this entry «
Note:This is the first post in what I hope will be a series leading up to my concurrency/distributed systems talk at PyCon. I'm steadily working through experimenting with and learning the various frameworks/libraries in the python ecosystem.
I reserve the right (and probably will) to revise these entries based on feedback from people (mainly the ...
January 28th, 2009 § § permalink
Steve Holden shot an email out to python dev last night. In it, he said something which at first tweaked me, but in thinking about it, I both see, and some part of me agrees with his point. To quote:
I think that both 3.0 and 2.6 were rushed releases. 2.6 showed it in the
inclusion (later recognizable as somewhat ill-advised so late in the
day) of multiprocessing; 3.0 shows it in the very fact that this
discussion has become necessary. So we face an important turning point:
is 3.1 going to be serious production quality or not?
» Read the rest of this entry «
Steve Holden shot an email out to python dev last night. In it, he said something which at first tweaked me, but in thinking about it, I both see, and some part of me agrees with his point. To quote:
I think that both 3.0 and 2.6 were rushed releases. 2.6 showed it in the
inclusion ...
January 27th, 2009 § § permalink
January 27th, 2009 § § permalink
Last night Trent Nelson dropped a friendly note to the python-committers mailing list, you can see the full text here.
He and others (including donations from various companies) have put together a network of machines with various operating systems aimed at giving various projects wider (and complete, hooray logins!) access to platforms we normally don’t have access to in addition to the ones we have, but don’t have login access to.
To quote Trent:
And that’s when it hit me. Buildbots are fine when everything is
running smoothly, but nothing compares to actually having access to
a system when you’re trying to debug something.
So, I thought to myself, why not buy a couple of clunky old boxes
off eBay and donate them to the PSF, such that all developers had
access to them? I dropped a note to Guido and Neal, they put me
in touch with Titus, who had just accepted a position at Michigan
State, and, well…
Ten months, seven trips to MSU, six blown fuses and about $60,000
later, I’m proud to introduce you all to Snakebite: The Open Network!
A network of around 37-ish servers of all different shapes and sizes,
spread over three sites, specifically geared towards the needs of
open source projects like Python.
Every CPython, Jython, IronPython and PyPy committer will have access
to every development server on the network. I’ve also extended the
offer to prominent Python projects like Django and Twisted.
Eventually, I’ll invite other open source projects to participate
(Apache, Subversion, MySQL, Postgres, etc), but the network is my
gift to All Things Python, first and foremost, so Python projects
will always get preferential treatment.
Trent and other have managed to begin work on scratching an itch I know a lot of us have felt. Just for multiprocessing alone, I have to maintain a small farm of VMware images (today I’m adding fbsd and opensolaris) to do bug fixes and development on.
Having a much larger, dedicated buildbot farm with login privileges is going to be awesome. Given that they’re expanding this to other projects as well is just icing on a delicious, delicious cake (mmm, cake).
I had considered doing something like this myself; but given I don’t have access to cheap hosting, or hardware — that’s sort of makes it impossible. I had sketched up a plan to get an Apple 1U machine and throw virtualbox/vmware on it and host as many OSes and accounts as possible (OS/X is currently the only OS without representation in the machines currently listed).
Really, this is fantastic and the work and time that’s gone into putting this together as well as the donations companies like HP, Microsoft and others have made is simple great.
As Trent notes in his email — they’re run out of physical room to host stuff right now, but I have to imagine that as word spreads more companies and people will gladly donate time and resource to what is really an excellent project. VPS hosts could probably also get in the game in time as well.
This is just awesome.
You can see the site they’ve put together at http://www.snakebite.org/ and http://www.snakebite.org/network
Additionally, Steve and Titus have posts too.
Last night Trent Nelson dropped a friendly note to the python-committers mailing list, you can see the full text here.
He and others (including donations from various companies) have put together a network of machines with various operating systems aimed at giving various projects wider (and complete, hooray logins!) access to platforms we normally ...
January 20th, 2009 § § permalink
January 16th, 2009 § § permalink
Suffering from insomnia this morning, I decided to delve into my python-list archive box in gmail. I normally only scan it once or twice a month due to signal to noise ratio. A post by James Mills here caught my eye:
I’ve noticed over the past few weeks lots of questions
asked about multi-processing (including myself).
For those of you new to multi-processing, perhaps this
thread may help you. Some things I want to start off
with to point out are:
“multiprocessing will not always help you get things done faster.”
“be aware of I/O bound applications vs. CPU bound”
“multiple CPUs (cores) can compute multiple concurrent expressions -
not read 2 files concurrently”
“in some cases, you may be after distributed processing rather than
multi or parallel processing”
cheers
James
» Read the rest of this entry «
Suffering from insomnia this morning, I decided to delve into my python-list archive box in gmail. I normally only scan it once or twice a month due to signal to noise ratio. A post by James Mills here caught my eye:
I've noticed over the past few weeks lots of questions
asked about multi-processing (including myself).
For ...
January 8th, 2009 § § permalink
Someone pinged me recently — he was having a problem handling a keyboard interrupt when using multiprocessing.Pool.
Fundamentally, the problem comes with the fact that if a process gets an exception, it just throws the exception instead of returning or becoming .join()-able by the parent. You want to use pool.terminate() in the main function — but you also need to capture and handle the exception in the child so that when then exception is caught — the process can exit “gracefully”:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
| import multiprocessing
import time
def create():
try:
time.sleep(10)
except KeyboardInterrupt:
return
return 'hi mom'
def main():
def cb(what):
print what
pool = multiprocessing.Pool(2)
try:
for i in range(2):
pool.apply_async(create, args=(), callback=cb)
pool.close()
pool.join()
except KeyboardInterrupt:
print 'control-c presd butan'
pool.terminate()
if __name__ == "__main__":
main() |
If the exception is thrown within the child, and it just raises — it becomes unmanageable by the parent. As you can see from this piece of code (from pool.py, python trunk) the Pool is attempting to join() the child — which is of course, unjoinable (sort of like me, when I was a teenager):
1
2
3
4
5
6
7
8
| @classmethod
def _terminate_pool(cls, taskqueue, inqueue, outqueue, pool,
task_handler, result_handler, cache):
...
if pool and hasattr(pool[0], 'terminate'):
debug('joining pool workers')
for p in pool:
p.join() |
Someone pinged me recently - he was having a problem handling a keyboard interrupt when using multiprocessing.Pool.
Fundamentally, the problem comes with the fact that if a process gets an exception, it just throws the exception instead of returning or becoming .join()-able by the parent. You want to use pool.terminate() in the main function ...
January 7th, 2009 § § permalink
I just checked in and pushed a new version to pypi — in this case, I was really jonesing for the ability to push tests I wrote that imported the module/config dict through pychecker.
This wasn’t possible due to the loading system’s reliance on nose being the caller — so I added some environment checking to it to autoload. See the docs on pypi
I just checked in and pushed a new version to pypi - in this case, I was really jonesing for the ability to push tests I wrote that imported the module/config dict through pychecker.
This wasn't possible due to the loading system's reliance on nose being the caller - so I added some environment ...