[Twisted-Python] more thoughts on resumable async data flows
smurf at noris.de
Thu Mar 20 04:46:55 EST 2003
On Fri, 14 Mar 2003 06:50:03 +0000, Clark C. Evans wrote:
> Anyway, it's in the sandbox if anyone wants to play...
Looks nice. I'll probably use that (for processing a rather large
amount of database results).
> P.S. Unfortunately, it looks like PauseFlow doesn't
> work in the context of a generator... pity. Hopefully
> I'm doing something wrong.
You can't leave a generator with an exception and expect it to be
resumable. (Where should it continue?? There's no mechanism to re-enter it
at any point other than a yield(), which is not what you want to do!)
The best idea would probably be to "yield PauseFlow", and to special-case
that in the flow engine. I don't know what your use case is, though; my
iterators either don't wait for something (they don't need this), or
they block on something (I park them in a different thread), or they
wait on a Deferred or whatever (they're not written as generators).
More information about the Twisted-Python