On Aug 11, 3:04 pm, Gloria W <[email protected]> wrote:
>   Hi Michael,
> In the fourth example you sent, I am getting a key error here:
>
> # Similarly, we also need to notify the filter/processor components that
> # we've ceased sending them any data. This idiom of reusing an outbox is
> # a convenience that tidies up code.
>          for c in self.childComponents():
>              L = self.link( (self, "_cs"), (c, "control"))
>              self.send( Axon.Ipc.producerFinished(), "_cs")
>              self.unlink(thelinkage=L)
>
> self.link fails, claiming that "_cs" is not defined. Should the box name
> be "signal" instead?

Ah, that confused me for a moment, primarily because I tested the code
before mailing it. If you compare the version with comments:
    * http://pastebin.com/HQcDesx4

To the one without:
    * http://pastebin.com/mpcsSKeu

You'll note that the former has the component signature of:

class
TaggingPluggableProcessor(Axon.AdaptiveCommsComponent.AdaptiveCommsComponent):
    Inboxes = {
        "inbox": "Stream of data to process",
        "processor": "Processor requests are sent here",
        "control" : "So we can shutdown"
    }
    def main(self):

Whereas the latter has the component signature of:

class
TaggingPluggableProcessor(Axon.AdaptiveCommsComponent.AdaptiveCommsComponent):
    Inboxes = {
        "inbox": "Stream of data to process",
        "processor": "Processor requests are sent here",
        "control" : "So we can shutdown"
    }
    Outboxes = {
        "outbox": "Stream of tagged processed data",
        "signal": "To pass on shutdown",
        "_cs" : "For shutting down internal components"
    }

So, please use this latter signature instead!

Incidentally, as a convention, it's useful to name inboxes and
outboxes with leading underscores like _this when they're intended to
talk to subcomponents rather than the outside world. Whilst they don't
have to be used that way, it can simplify things for people looking at
the component signature.

Also that should make it clearer why "signal" isn't used for sending
signals to subcomponents. Lack of having a leading underscore implies
it's public, not private.

Sample components that do this incidentally include:

Chassis/Carousel.py:                 "_signal"     : "internal use:
for sending 'shutdownMicroprocess' to child",
Chassis/ConnectedServer.py:    Inboxes = { "_socketactivity" :
"Messages about new and closing connections here",
Chassis/ConnectedServer.py:    Outboxes = { "_serversignal" : "we send
shutdown messages to the TCP server here",
Chassis/Graphline.py:   Outboxes = {"outbox":"", "signal":"", "_cs":
"For signaling to subcomponents shutdown"}
Chassis/PAR.py:               "_co": "For passing data to
subcomponents based on a policy (unusued at present)",
Chassis/PAR.py:               "_cs": "For signaling to subcomponents
shutdown",
Experimental/Services.py:                 "_toService" : "request to
service",
File/BetterReading.py:        "_selectorready" : "ready to read"
File/BetterReading.py:        "_selectorask"   : "ask the Selector to
notify readiness to read on a file"
File/UnixProcess2.py:                 "_shutdownPipes" : "For shutting
down any named pipes used for output"
Internet/ConnectedSocketAdapter.py:                "_selectorSignal" :
"For communication to the selector",
Internet/SingleServer.py:              "_oobinfo" : "We receive
notification of connection on this inbox"
Internet/TCPClient.py:                "_socketFeedback" :
"notifications from the ConnectedSocketAdapter",
Internet/TCPClient.py:                "_selectorSignal"       : "For
registering and deregistering ConnectedSocketAdapter components with a
selector service",
Internet/TCPServer.py:   Inboxes  = {  "_feedbackFromCSA" : "for
feedback from ConnectedSocketAdapter (shutdown messages)",
Internet/TCPServer.py:                "_selectorSignal"       : "For
registering newly created ConnectedSocketAdapter components with a
selector service",
Internet/TCPServer.py:                "_selectorShutdownSignal" : "To
deregister our interest with the selector",
Internet/UDP_ng.py:                 "_selectorSignal" : "For
communication to the selector"
Util/Backplane.py:                 "_outbox" : "To backplane if a
forwarder",
Util/Splitter.py:                "_inbox"        : "Internal inbox for
receiving from the child source component (if it exists)",
Util/Splitter.py:                "_control"      : "Internal inbox for
receiving from the child source component (if it exists)",

Probably should've mentioned that before. It's mentioned here:
   * http://www.kamaelia.org/Docs/NotationForVisualisingAxon.html

But as I say, the website does need an overhaul!

Thanks for point out the typo!


Michael.

-- 
You received this message because you are subscribed to the Google Groups 
"kamaelia" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/kamaelia?hl=en.

Reply via email to