[Twisted-Python] feedback requested -- flow.py goes beta
Clark C. Evans
cce at clarkevans.com
Sat Apr 19 13:55:54 MDT 2003
When to use flow?
For simple processes which can be broken down into
a small set of chunks, then Deferred is the best way
to go. To make it worth while to use flow, you need
one of the following:
a) incremental results: for example, a big or slow
executing database query that needs to process
results as they become available.
b) merging or splitting: for example, having two
database queries running in parallel, the
results being merged together
c) complicated chunking: if your deferred chunks
start to get numerous or have non-trivial logic
in them, then flow would be useful.
d) intensive computations: if your process has
computations that need to be broken into
chunks, then flow may be better than deferreds.
Recent changes:
I renamed flow.ThreadedIterator to flow.Threaded,
as it is now a wrapper (you don't inherit).
Clark
On Thu, Apr 17, 2003 at 04:09:57PM +0000, Clark C. Evans wrote:
| Abstract: >
|
| The flow module implements cooperative multi-tasking using
| iterators (easily created with generators) and Twisted's
| event reactor. The flow module also includes support for
| incrementally returning query results from Twisted's
| database connection pool. While this module does _not_
| require generators (a python v2.2 feature), applications
| of the module are best demonstrated with generators.
|
| Status: >
|
| The flow module (flow.py) is currently checked into CVS in
| the sandbox directory. It is unlikely that any large
| changes to the module will happen. The documentation
| is partial, but currently in development.
|
| General feedback from the Twisted Community is requested.
|
| Deployment: >
|
| If flow was accepted into twisted, I was thinking
| of spreading its functionality over several files.
|
| 1. Adding a base implementation module, twisted.python.flow,
| which only depends upon other items in twisted.python
|
| 2. Adding a (fairly small) Flow class to
| twisted.internet.defer which takes the base
| implementation and uses the reactor and inherits
| from Deferrred.
|
| 3. Adding a ThreadedIterator class to twisted.internet.threads
| which depends upon twisted.internet.reactor and
| twisted.python.*
|
| 4. Adding a (fairly small) QueryIterator class to
| twisted.enterprise.adbapi which depends primarly
| on ThreadedIterator, but provides for query
| functionality from a ConnectionPool
|
| Best,
|
| Clark
|
| _______________________________________________
| Twisted-Python mailing list
| Twisted-Python at twistedmatrix.com
| http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
More information about the Twisted-Python
mailing list