
I have a master machine ,that will control hundreds remote servers(agent). It will send authenticate and command message to remote agent. The master will run months. And I can't sure which command will be sent, and when it will be sent. So I cann't write it in codes as "reactor.callLater" then "reactor.run()". I need sth like a task pool, I can push a command into it in anytime, and the pool will send out the command immediately. Those commands will be send to different agent. The "other logic" is "pushing commands into the pool". It's unsure before running.
It's hard to know what you need here. Can you elaborate more on this "other logic"?
Note though that the callLater will also "make the sendCmd be called after the reactor run" -- although a clearer phrasing would be "make the sendCmd be called after the reactor starts", so I don't understand why it is inappropriate for you.
Also, saying "the server(reactor)" suggests to me that you misunderstand the role of the reactor. The reactor isn't your server; it's the event loop that runs all the networking Twisted does, servers, clients, whatever. You don't want to stop and start it for each task, or have a seperate one for each task, it's a single object that handles the events that occur (like sockets receiving data) and dispatching them to the right object.
-Andrew.
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-- Xu Ryans