[Twisted-Python] Connectionless AMP?
Hello, I want to implement a messageing protocol running on top of TIPC / SOCK_RDM to be able to do multicasting; ie. send messages in a connectionless manner. I implemented some TIPC support, but I now wonder how to go about the protocol. Originally, I thought about using AMP, but this seems to assume a connection-oriented transport. How would you go about this? Should it be possible to use a datagram-like, connection-less transport with AMP? Or should I rather take a more low-level approach, eg. by using IntNStringReceiver and roll my own? Thanks for any advice. peter.
Hi I tried to enhance my test.tac file with : application = service.Application("test") application.setComponent(ILogObserver, LogFile('test.log', '/var/log/', rotateLength=10000).write) : The logfile is created but the log messages vanish into thin air, log file size remains at zero. What am I doing wrong? TIA, Werner
On Thu, 20 Nov 2008 18:50:07 +0100, Werner Thie <wthie@thiengineering.ch> wrote:
Hi
I tried to enhance my test.tac file with
: application = service.Application("test") application.setComponent(ILogObserver, LogFile('test.log', '/var/log/', rotateLength=10000).write) :
The logfile is created but the log messages vanish into thin air, log file size remains at zero.
What am I doing wrong?
Are you using trunk@25379 or newer? Jean-Paul
On Thu, Nov 20, 2008 at 12:50 PM, Werner Thie <wthie@thiengineering.ch> wrote:
Hi
I tried to enhance my test.tac file with
: application = service.Application("test") application.setComponent(ILogObserver, LogFile('test.log', '/var/log/', rotateLength=10000).write)
You should not pass the write method as an observer: an observer must be a callable that takes a dict. You probably want to import FileLogObserver from twisted.python.log, and pass an instance of that: application.setComponent(ILogObserver, FileLogObserver(LogFile("test.log", "/var/log", rotateLength=10000))) -- Christopher Armstrong http://radix.twistedmatrix.com/ http://planet-if.com/ http://canonical.com/
On Thu, Nov 20, 2008 at 2:58 PM, Christopher Armstrong <radix@twistedmatrix.com> wrote:
On Thu, Nov 20, 2008 at 12:50 PM, Werner Thie <wthie@thiengineering.ch> wrote:
Hi
I tried to enhance my test.tac file with
: application = service.Application("test") application.setComponent(ILogObserver, LogFile('test.log', '/var/log/', rotateLength=10000).write)
You should not pass the write method as an observer: an observer must be a callable that takes a dict.
You probably want to import FileLogObserver from twisted.python.log, and pass an instance of that:
application.setComponent(ILogObserver, FileLogObserver(LogFile("test.log", "/var/log", rotateLength=10000)))
Sorry, I didn't test this code. Change that to... application.setComponent(ILogObserver, FileLogObserver(LogFile("test.log", "/var/log", rotateLength=10000)).emit) maybe that code will work. -- Christopher Armstrong http://radix.twistedmatrix.com/ http://planet-if.com/ http://canonical.com/
Thank you so much, works like a charm! Isn't this a snippet which could go into the FAQ about twistd? Or should there be a WIKI page about logging in general? Werner Christopher Armstrong wrote:
On Thu, Nov 20, 2008 at 2:58 PM, Christopher Armstrong <radix@twistedmatrix.com> wrote:
On Thu, Nov 20, 2008 at 12:50 PM, Werner Thie <wthie@thiengineering.ch> wrote:
Hi
I tried to enhance my test.tac file with
: application = service.Application("test") application.setComponent(ILogObserver, LogFile('test.log', '/var/log/', rotateLength=10000).write) You should not pass the write method as an observer: an observer must be a callable that takes a dict.
You probably want to import FileLogObserver from twisted.python.log, and pass an instance of that:
application.setComponent(ILogObserver, FileLogObserver(LogFile("test.log", "/var/log", rotateLength=10000)))
Sorry, I didn't test this code. Change that to...
application.setComponent(ILogObserver, FileLogObserver(LogFile("test.log", "/var/log", rotateLength=10000)).emit)
maybe that code will work.
On Fri, Nov 21, 2008 at 1:15 AM, Werner Thie <wthie@thiengineering.ch> wrote:
Thank you so much, works like a charm!
Isn't this a snippet which could go into the FAQ about twistd? Or should there be a WIKI page about logging in general?
It's already documented in "Using the Twisted Application Framework", which will be published to the web site as soon as the version of Twisted which includes this new ILogObserver API is released. The document is hosted in SVN at doc/core/howto/application.xhtml. -- Christopher Armstrong http://radix.twistedmatrix.com/ http://planet-if.com/ http://canonical.com/
On Thu, 20 Nov 2008 17:58:32 +0100, Peter Sabaini <peter@sabaini.at> wrote:
Hello,
I want to implement a messageing protocol running on top of TIPC / SOCK_RDM to be able to do multicasting; ie. send messages in a connectionless manner.
I implemented some TIPC support, but I now wonder how to go about the protocol. Originally, I thought about using AMP, but this seems to assume a connection-oriented transport.
How would you go about this? Should it be possible to use a datagram-like, connection-less transport with AMP? Or should I rather take a more low-level approach, eg. by using IntNStringReceiver and roll my own?
Thanks for any advice.
You can use AMP to format your datagrams, but you'll have to do extra work if you want any of the command-related functionality to work, since it assumes a reliable transport. `AmpBox´ has a `serialize´ method and `twisted.protocols.amp´ has the free function `parseString´. Jean-Paul
On Thursday 20 November 2008 20:53:04 Jean-Paul Calderone wrote:
On Thu, 20 Nov 2008 17:58:32 +0100, Peter Sabaini <peter@sabaini.at> wrote:
Hello,
I want to implement a messageing protocol running on top of TIPC / SOCK_RDM to be able to do multicasting; ie. send messages in a connectionless manner.
I implemented some TIPC support, but I now wonder how to go about the protocol. Originally, I thought about using AMP, but this seems to assume a connection-oriented transport.
How would you go about this? Should it be possible to use a datagram-like, connection-less transport with AMP? Or should I rather take a more low-level approach, eg. by using IntNStringReceiver and roll my own?
Thanks for any advice.
You can use AMP to format your datagrams, but you'll have to do extra work if you want any of the command-related functionality to work, since it assumes a reliable transport.
`AmpBox´ has a `serialize´ method and `twisted.protocols.amp´ has the free function `parseString´.
Thanks, I'll try that! peter.
Jean-Paul
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
participants (4)
-
Christopher Armstrong -
Jean-Paul Calderone -
Peter Sabaini -
Werner Thie