Hi again Murphy,

I got all caught up with other thesis work and completely forgot about this. I've been using a version of this in my own work since my last message and it's been pretty convenient, though, so I figured I should follow up.

I don't think it has to be limited to callables at all (my example just happened to require that), I think it could take any arbitrary python objects. For example, you pass in a dict of component_name:kwargs, or better, component_name:[kwargs1, kwargs2] which launches multiple instances with potentially different arguments. (Essentially passing in the 'components' dict directly, instead of constructing it from strings.)

https://github.com/krman/pox/commit/059b81b8a9c05f7d80d64593cd4754facbc1f65f (written on the basis of what was easiest for me at the time, rather than the most perfect placement...) shows roughly what I mean.

-- Kim


On 07/08/14 14:46, Murphy McCauley wrote:
On Aug 6, 2014, at 7:43 AM, Kim Manning <kmann...@gmx.com> wrote:

Sorry, was a bit unclear in my original email. The base-component thing is not 
an issue. As an aside, it hadn't occurred to me that the launch functions were 
designed only for command line args. I'd just been calling the ones for my 
sub-components directly from the base. Seems to work.

Anyway - yes, my main issue is that I don't want to use pox.py. Thanks for the 
quick suggestions - I played around a bit with boot.py and came up with 
something that seemed to work well. I let boot() take a dict of components in 
the format that _do_launch() builds at the start, and split out the argv 
parsing from _do_launch for when I do want to use pox.py and pass in a real 
argv list. So I can simply write something like(using similar examples to 
before)

from pox.boot import boot
from mypackage.function1 import callback
args = {'component1': [ {'callback': callback} ]}
boot(args)

and end up with the callback function directly in my component1 launch function.
Yeah.  I think we could actually modify boot()/_do_launch() to just take a list 
of strings and callables.  Strings would be interpreted as they are now.  
Callables would just be called, letting you do whatever you wanted at that 
point.

Still have some issues with pox_options that I didn't think that hard about 
because I don't use them much.
Yeah.  I have never liked them and try to not introduce new ones.  The trend 
has actually been to eliminate them.

Reply via email to