[Twisted-Python] LoopingCall and object instances

Ladislav Andel ladaan at iptel.org
Wed Aug 22 16:59:28 EDT 2007

I found the answer myself here at 

I followed the code and implemented to my class start and stop methods 
which solved my problem
with taking out object instances from loop testing.


Ladislav Andel wrote:
> Hello,
> I have got following code:
> hosts = ['google.com','yahoo.com']
> for host in hosts:
>        c = PingContext(num, host)
>        ctx.append(c)
>        l = task.LoopingCall(c.ping)
>        l.start(30.0, False)
> I create a few object instances and pinging those hosts every 30 secs.
> I will have another loop through LoopingCall, where I will be checking 
> dynamically changing list and comparing with already been checking hosts.
> If there is a host missing in the list I will delete the object 
> instance which is not in the list.
> How can I remove it that it will not be anymore called by LoopingCall?
> Or how can I add a new object instance to the LoopingCall in case 
> there is new host in the list?
> Hopefully, it's understandable.
> Thank you,
> Lada
> _______________________________________________
> 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