[Twisted-Python] Client/Server to stream text logfiles?
Jason Rennie
jrennie at gmail.com
Tue Sep 27 07:13:59 MDT 2011
Sounds like your project would be appropriate for twisted. You'll have the
easiest time if the reading and writing can each be implemented as a
separate process (independent of other jobs on the machines). Be sure to
read the following documentation:
http://twistedmatrix.com/documents/current/core/howto/servers.html
http://twistedmatrix.com/documents/current/core/howto/clients.html
http://twistedmatrix.com/documents/current/core/howto/defer.html
Here are references you'll likely make use of:
http://twistedmatrix.com/documents/current/api/twisted.protocols.basic.LineReceiver.html
http://twistedmatrix.com/documents/current/api/twisted.internet.protocol.ReconnectingClientFactory.html
I wonder if using a ProcessProtocol (
http://twistedmatrix.com/documents/current/core/howto/process.html) with
"tail -f" would be an option for monitoring changes to the log(s)? Though,
this may not be robust to failure (how to do you find the place where you
left off if the watching process dies unexpectedly?) I'm not very familiar
with twisted file-related code, but, the "fdesc" module might be useful:
http://twistedmatrix.com/documents/current/api/twisted.internet.fdesc.html
Do any twisted experts have recommendations for monitoring changes to a
file?
Victor, let me suggest that you explore whether twisted can satisfy all your
requirements before you start coding as it is can be nontrivial to use
twisted with non-twisted-friendly libraries.
Cheers,
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20110927/b4df6843/attachment.html>
More information about the Twisted-Python
mailing list