Hi Jim,
On Wednesday 10 June 2009 15:28:30 Jim wrote:
> Apologies if I've missed something obvious in the documentation, but
> I'm having difficulty coming up with an elegant way of doing this:
If I understand this correctly, logically what you're after is something
that's a bit like this:
Pipeline(
A,
B,
C,
D,
).run()
But where *any* component in there can cause a shutdown. Of course today, the
above Pipeline is equivalent to this graphline:
Graphline(
ONE= A,
TWO= B,
THREE= C,
FOUR= D,
linkages = {
("self", "inbox"): ("ONE","inbox"),
("self", "control"): ("ONE","control"),
("ONE", "outbox"): ("TWO","inbox"),
("ONE", "signal"): ("TWO","control"),
("TWO", "outbox"): ("THREE","inbox"),
("TWO", "signal"): ("THREE","control"),
("THREE", "outbox"): ("FOUR","inbox"),
("THREE", "signal"): ("FOUR","control"),
("FOUR", "outbox"): ("self","outbox"),
("FOUR", "signal"): ("self","signal"),
}
).run()
And if I understand what you want correctly, this is the equivalent graphline:
from Kamaelia.Util.Fanout import Fanout
from Kamaelia.Util.PassThrough import PassThrough
Graphline(
ONE= A,
TWO= B,
THREE= C,
FOUR= D,
FANOUT = Fanout(["toPS", "toA", "toB", "toC", "toD", "toOUT"])
PS = PassThrough(),
linkages = {
("self", "inbox"): ("ONE","inbox"),
("ONE", "outbox"): ("TWO","inbox"),
("TWO", "outbox"): ("THREE","inbox"),
("THREE", "outbox"): ("FOUR","inbox"),
("FOUR", "outbox"): ("self","outbox"),
("self", "control"): ("FANOUT","inbox"),
("ONE", "signal"): ("FANOUT","inbox"),
("TWO", "signal"): ("FANOUT","inbox"),
("THREE", "signal"): ("FANOUT","inbox"),
("FOUR", "signal"): ("FANOUT","inbox"),
("PS", "signal"): ("FANOUT","control"),
("FANOUT", "toA"): ("ONE", "control")
("FANOUT", "toA"): ("TWO", "control")
("FANOUT", "toA"): ("THREE", "control")
("FANOUT", "toA"): ("FOUR", "control")
("FANOUT", "toPS"): ("PS", "control")
("FANOUT", "toOUT"): ("self", "signal")
}
).run()
Looking at that, whilst that's probably the way to do it at the that's quite
painful, and I'd be open to a better syntax. Say this:
Pipeline(
A,
B,
C,
D,
linkage_pattern = "AnyShutdown".
).run()
or some other better name for this? I'm open to suggestions, because I've
recently changed Pipeline so that you can do this:
Pipeline(
A,
B,
C,
D,
circular = True,
).run()
Which links the output of D into the input of A. (A can still accept data from
the outside world). In a way, this is potentially similar if you could do
something like:
Pipeline(
A,
B,
C,
D,
circular = OnlyData,
).run()
Pipeline(
A,
B,
C,
D,
circular = OnlySignals,
).run()
As I say, at the moment the only option is to use the graphline above, but I'm
more than happy to generalise this slightly.
You may also want to be aware of these experimental additions to Graphline,
Pipeline & Carousel by Matt a while back:
http://www.kamaelia.org/Components/pydoc/Kamaelia.Experimental.Chassis
Any thoughts on a preferred syntax are very welcome.
Regards,
Michael.
--
http://yeoldeclue.com/blog
http://twitter.com/kamaelian
http://www.kamaelia.org/Home
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---