[01:17] *** TheBashar has parted #kamaelia
[08:04] *** Uraeus has joined #kamaelia
[08:22] < ms-afk> Looks like a distutils bug
[08:22] < ms-afk> Something that can be worked around. But a pain.
[08:57] *** ms-afk is now known as ms-
[10:22] *** Uraeus has joined #kamaelia
[11:36] *** TheBashar has joined #kamaelia
[11:39] < TheBashar> ms-: So your gut feel is that it is a distutils bug in 2.6.1? I was thinking maybe I should try pulling kamaelia from svn. Put that won't help if it's a distutils problem.
[11:43] < ms-> Well, it's not a distutils problem per se.
[11:44] < ms-> It's a "distutils isn't sufficiently intelligent" problem
[11:44] < ms-> The problem part of the setup.py file is this:
[11:44] < ms-> data_files=[ ('/usr/local/share/kamaelia', ['App/kamaelia_logo.png']) ],
[11:45] < ms-> which says take 'App/kamaelia_logo.png' and place it in "/usr/local/share/kamaelia"
[11:45] < ms-> if you remove that line it'll work OK
[11:46] < ms-> I may need to rethink data files anyway
[11:46] < TheBashar> Ok, thank you. I'll try that. So this might be the same problem mentioned in google groups as a sandbox violation when using easy_install?
[11:46] < ms-> I think so
[11:47] < ms-> hence my pondering about rethinking data files :)
[11:48] < TheBashar> Definitely, I mean who wants to install kamaelia if you don't get the cute cat logo? ;)
[11:51] < TheBashar> Removing that line worked. Thanks again for your help!
[11:51] < ms-> You're welcome :)
[12:37] *** TheBashar has parted #kamaelia
[14:28] *** TheBashar_web has joined #kamaelia
[14:30] < TheBashar_web> What is the best way to run two independant (non connected) components at the same time? Using a backplane? I tried just running one then the other but I see the run() method blocks.
[14:32] < ms-> One.activate()
[14:32] < ms-> Two.run()
[14:32] < ms-> .run() is a convenience method really
[14:33] < TheBashar_web> So componentB.run() will run everything, assuming I previously activated componentA? Cool.
[14:33] < ms-> Yep
[14:34] < TheBashar_web> Thank you. Sorry to keep pestering with the beginner questions.
[14:35] < ms-> That's fine :)
[14:40] < TheBashar_web> I'm going to want to rotate the ports that are listened on over time.
[14:40] < TheBashar_web> I'm about to google for kamaelia scheduled tasks and the opposite of the activate (deactivate?).
[14:40] < TheBashar_web> Before I go down that road though, should I look into a carousel?
[14:44] < ms-> The opposite of activate is to send a message to the component shutdownMicroprocess - to its control inbox
[14:45] < ms-> The reason for not calling a method on the component from the outside is to avoid any concurrency issues, since you can't know for certain what state the component is in otherwise.
[14:46] < TheBashar_web> Okay, I'm using producerFinished to close the connection after sending the motd. Using shutdownMicroprocess will stop listening on the port and tear down the protocol handler?
[14:46] < ms-> shutdownMicroprocess is generally used as a message to tell a component "shutdown now". producerFinished means "I'm not sending you any more data"
[14:47] < ms-> So if you want to shut down a ServerCore, sending it a shutdownMicroprocess will tear it down
[14:47] < ms-> http://www.kamaelia.org/Cookbook/TCPSystems - may be of help here
[14:49] < TheBashar_web> Yes, I've been following that but I subbed producerFinished from your pastebin example. Now I see where I should use each. Thanks.
[14:49] < ms-> As might this:
[14:49] < ms-> http://www.kamaelia.org/Docs/NotationForVisualisingAxon
[14:50] < ms-> Also, this server has a slide show which walks through the run time behaviour: http://www.kamaelia.org/KamaeliaGrey
[14:50] < ms-> Slides 31 & 32 specifically :)
[14:51] < TheBashar_web> Great! :) I had not seen that notations page before. That will help.
[14:52] < ms-> :)
[14:52] < ms-> I've given a variety of presentations on kamaelia in the past, and so some of these may be of use: http://www.slideshare.net/kamaelian/slideshows
[14:53] < TheBashar_web> Good stuff. I stumble a lot but when I finally get it, I like the way it makes sense. Fits my brain easier than twisted.
[14:55] < ms-> :)
[15:08] < aa_> ms-: have you seen: http://opensource.hyves.org/concurrence/
[15:40] < TheBashar_web> I'm trying to make a component that periodically (everey 3s) sends a message. The only example I've found so far is torrentclient which uses rawserver.addtask(). Is this the best way to go about periodic tasks?
[15:41] < ms-> It varies, but there's two approaches I take
[15:42] < ms-> One is to have a component sit and wait for a message on an inbox, and when it gets one it does something , and to have a "pinger" component
[15:42] < ms-> The other is to just do the two things in one.
[15:42] < ms-> The latter is simpler really
[15:43] *** ms- writes something in a pastebin
[15:44] < TheBashar_web> I'm okay with the pinger component, but I'm not seeing how to make the pinger periodically ping.
[15:45] < ms-> http://pastebin.com/m3578ae56
[15:47] < TheBashar_web> Oh, okay, I'm a boob. So it's as simple as time.sleep() as long as it's on a separate thread.
[15:52] < ms-> If you wanted something a bit like hardware, where a single timed clock awakens other components, you can do this: http://pastebin.com/m855e8a0
[15:52] < ms-> That activates 3 components every 3 seconds
[15:55] < TheBashar_web> Thanks, that's great! I think the basic timed echoer will do for what I need now. But I'm going to save that backplane clock example. That example of having the components sleep and wake up would come in handy for other things.
[15:56] < ms-> :)
[15:56] < ms-> That's useful to hear :)
[16:48] < TheBashar_web> self.send( self.recv("signal"), "control")
[16:48] < TheBashar_web> That's backwards? Shouldn't it be: self.send(self.recv("control"), "signal")
[17:40] < ms-> Yes, what I wrote was backwards
[17:40] < ms-> one of those days :)
[17:42] < TheBashar_web> :) I'm just happy I finally understood something on my own.
[17:42] < TheBashar_web> Am I going to run into any problems activating new components once we're already run()ing?
[17:43] < ms-> Nope.
[17:43] < ms-> What actually happens is calling .activate effectively ends up adding the component to a threadsafe queue, which are then popped off the queue by the scheduler, which then runs them
[17:44] < ms-> It needs to be a threadsafe queue due to the existence of threaded components, but you can be happy that it's done safely :)
[17:45] < TheBashar_web> I am. On a side note, I'm looking forward to seeing any progress made in the future on integrating kamaelia with the new multiprocess module.
[17:49] < TheBashar_web> Is there a significant difference between getting a single self.recv("inbox") and iterating through self.Inbox("inbox")?
[18:01] < TheBashar_web> Also, if component1 is not tied (with say a pipeline) to component2, can a method in c1 still call c2.send("message", "inbox")?
[18:01] < TheBashar_web> Or do I somehow have to dynamically connect c1 outbox to c2 inbox, send the message, disconnect, and connect to c3, etc, etc
[18:06] < TheBashar_web> AdaptiveComsComponent?
[18:06] < TheBashar_web> outLinkage = self.link((theComponent,itsInbox), (self,newOut))?
[18:11] < ms-> "Is there a significant difference between getting a single self.recv("inbox") and iterating through self.Inbox("inbox")?"
[18:11] < ms-> for d in self.Inbox("inbox"):
[18:12] < ms-> is just syntactic sugar for
[18:12] < ms-> while self.dataReady("inbox"):
[18:12] < ms-> d = self.recv("inbox")
[18:12] < ms-> ...
[18:13] < ms-> "a method in c1 still call c2.send("message", "inbox")" isn't valid
[18:13] < ms-> but you can do
[18:13] < ms-> linkage = self.link((c1,"someoutbox"), (c2,"someinbox"))?
[18:14] < ms-> and then c1 would do self.send( ... "someoutbox")
[18:14] < ms-> AdaptiveComms Component is more about creating new inboxes/outboxes on the fly
[18:15] < ms-> for example the selector component needs to tell connected socket adapters when to wake up, and the numbers of connected sockets is unknown in advance
[18:18] < ms-> http://code.google.com/p/kamaelia/source/browse/trunk/Sketches/MPS/Examples/AIM/MultiAIMBot.py - specifically the MessageDemuxer class shows how to use the adaptive comms component relatively tidily
[18:34] < TheBashar_web> Thanks Michael!
[18:38] < TheBashar_web> The adaptive comms component page has an example of dynamically linking and unlinking. I'll just need to play around to get a feel for how to keep track of the linkages.
[18:52] *** ms- nods
[19:33] < TheBashar_web> If I send compB a shutdownMicroprocess() message
[19:33] < TheBashar_web> crap
[19:34] < TheBashar_web> If I send compB's control a shutdownMicroprocess message, will there be any problem unlinking compA->compB after compB has shutdown?
[20:39] *** TheBashar has joined #kamaelia
[20:49] < ms-> "will there be any problem unlinking" nope
[21:07] *** ms- calls it a night 
[21:07] *** ms- is now known as ms-afk
[21:36] < TheBashar> Two lines in http://www.kamaelia.org/Docs/Axon/Axon.AdaptiveCommsComponent.html
[21:37] < TheBashar> inLinkage = self.link((theComponent,itsOutbox),(self,newIn))
[21:37] < TheBashar> outLinkage = self.link((theComponent,itsInbox), (self,newOut))
[21:38] < TheBashar> Isn't the second line backwards? Shouldn't it be:
[21:38] < TheBashar> outLinkage = self.link((self, newOut), (theComponent, itsInbox))
[22:18] < TheBashar> ms: I finally found the documentation I've been dying for. If it's there already, I'm blind. If not, I suggest clearly linking to this much higher up on the documentation list: http://www.kamaelia.org/Docs/Axon/Axon.Component.html