August'24: Kamaelia is in maintenance mode and will recieve periodic updates, about twice a year, primarily targeted around Python 3 and ecosystem compatibility. PRs are always welcome. Latest Release: 1.14.32 (2024/3/24)
Extended versions of Kamaelia.Chassis.Pipeline, Kamaelia.Chassis.Graphline and Kamaelia.Chassis.Carousel that add the ability to specify size limits for inboxes of components.
A pipeline with inbox size limits on 3 of the components' "inbox" inboxes:
Pipeline( 5, MyComponent(), # 'inbox' inbox limited to 5 items
2, MyComponent(), # 'inbox' inbox limited to 2 items
MyComponent(), # 'inbox' inbox unlimited
28, MyComponent() # 'inbox' inbox limited to 28 items
)
A graphline where component 'A' has a size limit of 5 on its "inbox" inbox; and component 'C' has a size limit of 17 on its "control" inbox:
Graphline( A = MyComponent(),
B = MyComponent(),
C = MyComponent(),
linkages = { ... },
boxsizes = {
("A","inbox") : 5,
("C","control") : 17
}
)
A Carousel, where the child component will have a size limit of 5 on its "inbox" inbox:
Carousel( MyComponent(), boxsize=5 )
Decoding a Dirac video file and saving each frame in a separate file:
Pipeline(
RateControlledFileReader("video.dirac", ... ),
DiracDecoder(),
TagWithSequenceNumber(),
InboxControlledCarousel(
lambda (seqnum, frame) :
Pipeline( OneShot(frame),
FrameToYUV4MPEG(),
SimpleFileWriter("%08d.yuv4mpeg" % seqnum),
)
),
)
The behaviour of these three components/prefabs is identical to their original counterparts (Kamaelia.Chassis.Pipeline, Kamaelia.Chassis.Graphline and Kamaelia.Chassis.Carousel).
For Pipelines, if you want to size limit the "inbox" inbox of a particular component in the pipeline, then put the size limit as an integer before it. Any component without an integer before it is left with the default of an unlimited "inbox" inbox.
The behaviour therefore reduces back to be identical to that of the normal Pipeline component.
For Graphlines, if you want to size limit particular inboxes, supply the "boxsizes" argument with a dictionary that maps (componentName, boxName) keys to the size limit for that box.
Again, if you don't specify a "boxsizes" argument, then behaviour is identical to that of the normal Graphline component.
For Carousels, if you want a size limit on the "inbox" inbox of the child component (created by the factory function), then specify it using the "boxsizes" argument.
Again, if you don't specify a "boxsizes" argument, then behaviour is identical to that of the normal Carousel component.
InboxControlledCarousel behaves identically to Carousel.
The "inbox" inbox is equivalent to the "next" inbox of Carousel. The "data_inbox" inbox is equivalent to the "inbox" inbox of Carousel.
Carousel(componentFactory[,make1stRequest][,boxSize]) -> new Carousel component
Create a Carousel component that makes child components one at a time (in carousel fashion) using the supplied factory function.
Keyword arguments:
Graphline([linkages][,boxsizes],**components) -> new Graphline component
Encapsulates the specified set of components and wires them up with the specified linkages.
Keyword arguments:
InboxControlledCarousel(componentFactory[,make1stRequest][,boxSize]) -> new Carousel component
Create an InboxControlledCarousel component that makes child components one at a time (in carousel fashion) using the supplied factory function.
Keyword arguments:
Pipeline(*components) -> new Pipeline component.
Encapsulates the specified set of components and wires them up in a chain (a Pipeline) in the order you provided them.
Keyword arguments:
Got a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording!
Please leave you feedback here in reply to the documentation thread in the Kamaelia blog.
-- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT