[Twisted-Python] run queries in deffered, but not in transaction

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Tue Sep 15 08:55:22 MDT 2009


On 10:37 am, petshmidt at googlemail.com wrote:
>Hi,
>
>I'd like to run several queries in background, some of them may fail.
>Currently, I do runInteraction for each query. Is there a way to run
>them all in one deferred, so that if one of them fails, other are not
>aborted?

If you have a function along the lines of this one:

    def someInteractions(db):
        interactions = [
            db.runInteraction(one),
            db.runInteraction(two),
            db.runInteraction(three)]

Then a failure in one shouldn't affect two or three; likewise for any 
other failure or combination of failures.  They are naturally (ugh, not 
a good word, but I can't think of a better one) independent.  You have 
to go out of your way to associate them somehow.

Since it sounds like this isn't the behavior you're seeing, I think I'm 
probably misunderstanding some aspect of your question.  If this doesn't 
help, perhaps you can clarify?

Jean-Paul




More information about the Twisted-Python mailing list