Re: [Twisted-Python] [Twisted-web] Question regarding callLater() and service creation
This thread belongs on the twisted-python@ list, rather than twisted-web@, as it has nothing to do with twisted.web. Eric Chamberlain wrote:
I'm creating a service using Twisted. It has nothing to do with networking (I know that Twisted is an event-driven networking engine... stay with me here :). It's simply polling a database every 30 seconds. I'm using callLater() once the work has been completed. My question is does the reactor spawn a new thread once the callLater() timeout has been reached? If so, this would mean that the work being done may be effected by the GIL, correct?
Incorrect. callLater spawns no threads. There's nothing wrong or even particularly strange with using Twisted for projects unrelated to networking. An event loop with good facilities for spawning and interacting with subprocesses and calling functions at certain times has plenty of uses, even if you don't also need the capacity to handle network IO. That doesn't mean that Twisted is necessarily the best tool for your task, but I wouldn't rule it out automatically either. -Andrew.
On Thu, Mar 10, 2011 at 6:43 AM, Andrew Bennetts <andrew@bemusement.org>wrote:
There's nothing wrong or even particularly strange with using Twisted for projects unrelated to networking. An event loop with good facilities for spawning and interacting with subprocesses and calling functions at certain times has plenty of uses, even if you don't also need the capacity to handle network IO.
+1 Twisted is my preferred tool for managing subprocesses. I've even found it to be superior for the seemingly simple task of combining output from multiple processes. Jason
participants (2)
-
Andrew Bennetts
-
Jason Rennie