[Twisted-Python] Cancelling a pb callRemote

Phil Mayers p.mayers at imperial.ac.uk
Wed Sep 18 07:00:51 MDT 2013


On 18/09/13 13:34, exarkun at twistedmatrix.com wrote:
> On 12:03 pm, p.mayers at imperial.ac.uk wrote:
>> Is there any support, or any interest in / way to add support for
>> deferred cancellation in pb?
>>
>> Specifically I'd like do have something like:
>>
>> class blah(pb...):
>>   def remote_somelongtask(self, args):
>>     ...
>>     taskid = somefunc()
>>     d = defer.Deferred(lambda : canceltask(taskid))
>>     return d
>>
>> ...and on the client:
>>
>> d = callRemote('somelongtask', args)
>> ...
>> # now we no longer need it
>> d.cancel()
>>
>> ...and have the cancel the server-side task.
>
> s/task/Deferred/ :)
>
> +1 - particularly if you also want to tackle this for AMP.

I've never used (and have no particular use for) AMP so I'd have to take 
a look at it. It doesn't look so hard for pb, but I have "teh fear" in 
case the existing test coverage isn't good and a 10-line change would 
require writing 1000 lines of tests :o(

I'll have a look, but from the responses I'll assume neither pb nor AMP 
can do this, and will file a couple of tickets for reference.




More information about the Twisted-Python mailing list