Where to put our Multicore support in the Kamaelia tree?

April 28, 2008 at 09:11 PM | categories: python, oldblog | View Comments

As discussed before, Kamaelia now has multicore support in subversion in the form of ProcessPipeline and ProcessGraphlines, meaning taking any Kamaelia system and making it multicore is a matter of simply pre-pending "Process" to the pipeline set up. That's pretty cool - especially if you're aware of what our normal cookbook code looks like. The question I've really got is where to merge this on the mainline. Given how useful this would be, it strikes me that like ThreadedComponent & LikeFile and Introspection, this ought to live in Axon. However, like Introspection, it probably also ought to be used from inside the Kamaelia Namespace.

As a result, it seems to make sense to do this - Put the core code in:
Axon.Processes
But put the ProcessPipeline & ProcessGraphline component in:
Kamaelia.Chassis.Process
So that you would use them as:
from Kamaelia.Chassis.Process import ProcessPipeline, ProcessGraphline
I'm pretty sure that's a pretty good idea - since it allows updates to the implementation that these use without affecting the interface.
That said, people will probably search for Multicore as well, so is it worth the naming actually being this:
from Kamaelia.Chassis.Multicore import ProcessPipeline, ProcessGraphline
... or simply having that available as an alias ?

Fundamentally this would still be used in the same way as previously described:
from Kamaelia.Chassis.Multicore import ProcessPipeline # this or
from Kamaelia.Chassis.Process import ProcessPipeline   # this?

ProcessPipeline(
                Textbox(position=(20, 340), # Open first pygame window
                                 text_height=36,
                                 screen_width=900,
                                 screen_height=400,
                                 background_color=(130,0,70),
                                 text_color=(255,255,255)),
                TextDisplayer(position=(20, 90), # Open second pygame window
                                        text_height=36,
                                        screen_width=400,
                                        screen_height=540,
                                        background_color=(130,0,70),
                                        text_color=(255,255,255))
                )

But the naming affects where you go hunting for the functionality.

My personal preference is for the former (Kamaelia.Chassis.Process), though I can see user friendliness in naming something based on what people are likely to hunt for being attractive.
Used without care, multiprocess usage would probably hurt performance - since messages between components in separate processes are pickled objects, but generally speaking, we all know you'd take that into account, wouldn't you...?

Thoughts?
blog comments powered by Disqus