[Twisted-Python] DeferredList failure accumulation
Justin Johnson
justinjohnson at fastmail.fm
Fri Aug 29 14:41:26 MDT 2003
I've been doing a lot with DeferredList's lately and just want to make
sure I'm doing things the "right" way. There a couple different
situations where I want to report errors in Deferred's that are added to
a DeferredList.
1) I define a remote_status method on the PB client that initiates the
request. The PB server calls the remote_status method on the client to
update the status for the particular task and redisplay the grid below,
and if the status if a failure, passes the failure as an argument which
gets added to an overall list of failures that are displayed nicely when
all tasks are complete.
| 1 | 2 | 3 | 4 | status
----------------------------------
job1 | S | S | S | S | success
----------------------------------
job2 | S | F | S | F | failure
----------------------------------
Failures
----------------------------------
Task: job2
Step: step2
Failure: blah blah blah
Task: job2
Step: step4
Failure: blah blah blah
2) If the DeferredList is used in a general class that represents some
data type worked on by the PB server, have each Deferred have an errback
that adds its errors into a list of errors. Then add a callback to the
entire DeferredList that checks to see if there are any accumulated
failures. If it finds failures, it errback's with a list of the failure
objects represented as strings so we don't have to deal with
InsecureJelly problems.
Does this sound like an alright way to do this? Anyone have any
suggestions at improving this?
Thanks.
-Justin
More information about the Twisted-Python
mailing list