disqus/nydus — pull request #3 by gjcourt (2012-02-21 21:45:26+00:00)
Title: Added pipeline_map to the Cluster class

Pipelines all calls in the map context manager so that instead of being O(nm) where n is the number of calls and m is the number of hosts, execution now happens with runtime O(m) where m is the number of hosts.

Hosts that are not queried do not have pipelines executed on them to maximize efficiency.

TODO: Since this is a generic library, the pipeline_map should eventually be made generic since the functionality isn't necessarily available on all backends that will be supported

TODO: There is some cludgyness regarding the EventualCommand (promise) of a command. The issue is that once returned, the type of your result is a list(type(EventualCommand)) instead of your actual result. You have to do something like [r._wrapped for r in res] in order for your results to be of the correct type. That's very annoying. Either the EventualCommand class can be made to be less hidden (everything is wrapped to make it seem like it's the promised result instead of the result itself) or it should be an expectation of the context manager that assignments while in the context manager yield results of type EventualCommand, in which case it makes more sense to remove all the wrapped functions from the EventualCommand object.