[Twisted-Python] threads monitoring
Hello, How can I monitor the number of created threads when I use just function deferToThreds in my code? Could you give me an example, please? If I do following: ThreadPool.dumpStats() I get TypeError: unbound method dumpStats() must be called with ThreadPool instance as first argument (got nothing instead) Here I understand I have to make an instance of ThreadPool, but if I just use deferToThreads from threads module I'm not sure how to accomplish it. Thanks, Ladislav
On Aug 15, 2007, at 12:50 PM, Ladislav Andel wrote:
Hello, How can I monitor the number of created threads when I use just function deferToThreds in my code?
Could you give me an example, please?
If I do following: ThreadPool.dumpStats()
I get
TypeError: unbound method dumpStats() must be called with ThreadPool instance as first argument (got nothing instead)
Here I understand I have to make an instance of ThreadPool, but if I just use deferToThreads from threads module I'm not sure how to accomplish it.
If you're using the reactor in the usual fashion, you can grab its 'threadpool' attribute. from twisted.internet import reactor if(reactor.threadpool): reactor.threadpool.dumpStats() This attribute will be None util you've called one of the thread- related reactor methods. -phil
participants (2)
-
Ladislav Andel
-
Phil Christensen