[Twisted-Python] .tap and twistd and persistence

I've been using twisted for a couple of years, and am re-writing my application yet-again to make it even more twisty, so I'm trying to use the persistence mechanisms that come from services and applications, and I have hit a snag. I've conformed my application to the details of the tutorial in the docs (and I see the demonstrated method of making a 'plugin' is deprecated, and I get that message after registering my app and running mktap). First question: The deprecation warning tells me to look in twisted.plugin... but I don't see much in the way of docs in there. Where can I learn what I should do? Second question: Even though I'm using a fresh Twisted 2.2, installed from the tarball, I don't have any manpages... not for mktap or twistd, so the docs tell me to look in the manpage, but I can't (I'm on Ubuntu Breezy, FWIW). I see the man files themselves in my twisted source distribution, but they don't appear to be installed when I install twisted. Third question: I'm able to make a .tap file, run it, and send it ^C to shut it down. I get the [app]-shutdown.tap file, but when I try to run that file with 'twistd -f wrangler-shutdown.tap' I get a problem with the re-building of my objects. There's an attribute error, from one of the classes that's a part of my application. Do I have to write my application in some way to get it to persist and unpersist properly? There's nothing in my app that isn't pickle-able... it's just instances and dictionaries, nothing like open files or database connections. Thanks!

On Friday 14 April 2006 18:56, Matt Feifarek wrote:
I don't have any insight on your particular problems, but the wisdom of the list seems to be that the automatic persistence features are not intended for production-grade applications, but rather for debugging and development. Most authors I'd trust have stated that you're better off to save your state yourself on shutdown rather than rely upon the app-shutdown.tap turds. There has also been debate about whether or not mktap plugins are even a good idea at all for new applications. At any rate, I don't think it receives the same attention from the core developers that it once did. The moral seems to be that just because something is provided by Twisted does not mean it's a best practice. Mike.

On Sat, 15 Apr 2006 12:22:37 -0400, Mike Pelletier <mike@mkp.ca> wrote:
Hmm. This is unfortunate, but since it's unlikely to change soon (many external projects ended up picking up and using bits of Twisted that we ultimately decided are bad ideas) we should probably start documenting "accepted best practices" somewhere. I suggest a wiki page, linked from the front page, since the idea of "best practice" is an ongoing discussion with some disagreement and some consensus -- probably more appropriate for the wiki format than anything else we are currently using wiki for.

On 4/15/06, Mike Pelletier <mike@mkp.ca> wrote:
Thanks for the reply. So, if the docs tell us that this way is the way to use twisted, and they're wrong, where do we go to learn how to use twisted? The docs are quite clear about using application objects and making your code into a twisted 'plugin' rather than simply poking at the reactor (as in some of the quick-n-dirty tutorials). I can certainly write my own persistence code, but I'm a little worried that more of the "best practices" presented by the docs are wrong. Should I still use twistd? Should I use the application object? Etc. Shorter (and somewhat snippier): how do we use twisted in our projects, if the docs are wrong? I know that you personally aren't responsible to answer this question; I'm hoping some others might pipe in and point me to some other docs or other tutorials. Thanks.

On Monday 17 April 2006 12:34, Matt Feifarek wrote:
Looks like someone's slightly ahead of or behind you. The mktap howto at: http://twistedmatrix.com/projects/core/documentation/howto/mktap.html now reads: This document does not describe current Twisted best practice. The progress of this document is currently being tracked in issue 1139. The docs also suggest: The majority of users will use the .tac Python configuration files without needing to use the mktap serialization. This is certainly my preferred method, and I think that of most developers. I believe mktap was merely an attempt to expose the same functionality with higher-level tools. But take it with a grain of salt; I'm far, far from the inner circle. I'm just regurgitating lore I've picked up from this list to help conserve the attention of the wizards.
So, if the docs tell us that this way is the way to use twisted, and they're wrong, where do we go to learn how to use twisted?
Never hurts to ask the list, just as you've done. I think it's likely your questions have already resulted in attempts to improve the situation. Mike.

On Mon, 17 Apr 2006 12:53:29 -0400, Mike Pelletier <mike@mkp.ca> wrote:
On Monday 17 April 2006 12:34, Matt Feifarek wrote:
Yep. Really good question/answer threads are often useful enough to be turned into documentation themselves. Several of the better Twisted documents, if I recall correctly, were created in just this way. It always seems easier to reply to an email than to sit down and design a document from scratch.

On 4/17/06, Matt Feifarek <matt.feifarek+twisted@gmail.com> wrote:
Please point us at the docs that are wrong (hopefully in the bug tracker), and give them the "documentation" keyword. -- Christopher Armstrong International Man of Twistery http://radix.twistedmatrix.com/ http://twistedmatrix.com/ http://canonical.com/

On 4/17/06, Christopher Armstrong <radix@twistedmatrix.com> wrote:
Please point us at the docs that are wrong (hopefully in the bug tracker), and give them the "documentation" keyword.
According to that page: http://twistedmatrix.com/projects/core/documentation/howto/mktap.html It's already in the tracker (1139). When I click through, I don't end up there, but those links have never worked for me. I always get kicked back to the menu. It's also hard for us users of the libraries to know how to mark bugs for things like "this isn't the right way to use twisted" if we don't know what the right way is. I like Mike's suggestion, though; to stick with .tac and ditch the persistence for now.

On Monday 17 April 2006 13:56, Matt Feifarek wrote:
There is a typo in the URL, it's actually: http://twistedmatrix.com/trac/ticket/1139 (Typo has been noted in the ticket.) Mike.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Mike Pelletier wrote:
It's not actually a typo, it's a broken redirect, http://twistedmatrix.com/bugs/ redirects unconditionally to http://twistedmatrix.com/trac/report which breaks links to bugs all over the place, including mailing list archives. There is a patch attached to ticket #1517 which fixes this, but I don't know what the status of that patch is in regards to our website maintainer. - -David -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) iD8DBQFERDpQrsrO6aeULcgRAsv7AJ93P+GboziEJLfoFOaLVGD4cgTxtwCeJg5w hOVL/jy0MJUH/xvuQZoO18o= =T7TP -----END PGP SIGNATURE-----

On Friday 14 April 2006 18:56, Matt Feifarek wrote:
I don't have any insight on your particular problems, but the wisdom of the list seems to be that the automatic persistence features are not intended for production-grade applications, but rather for debugging and development. Most authors I'd trust have stated that you're better off to save your state yourself on shutdown rather than rely upon the app-shutdown.tap turds. There has also been debate about whether or not mktap plugins are even a good idea at all for new applications. At any rate, I don't think it receives the same attention from the core developers that it once did. The moral seems to be that just because something is provided by Twisted does not mean it's a best practice. Mike.

On Sat, 15 Apr 2006 12:22:37 -0400, Mike Pelletier <mike@mkp.ca> wrote:
Hmm. This is unfortunate, but since it's unlikely to change soon (many external projects ended up picking up and using bits of Twisted that we ultimately decided are bad ideas) we should probably start documenting "accepted best practices" somewhere. I suggest a wiki page, linked from the front page, since the idea of "best practice" is an ongoing discussion with some disagreement and some consensus -- probably more appropriate for the wiki format than anything else we are currently using wiki for.

On 4/15/06, Mike Pelletier <mike@mkp.ca> wrote:
Thanks for the reply. So, if the docs tell us that this way is the way to use twisted, and they're wrong, where do we go to learn how to use twisted? The docs are quite clear about using application objects and making your code into a twisted 'plugin' rather than simply poking at the reactor (as in some of the quick-n-dirty tutorials). I can certainly write my own persistence code, but I'm a little worried that more of the "best practices" presented by the docs are wrong. Should I still use twistd? Should I use the application object? Etc. Shorter (and somewhat snippier): how do we use twisted in our projects, if the docs are wrong? I know that you personally aren't responsible to answer this question; I'm hoping some others might pipe in and point me to some other docs or other tutorials. Thanks.

On Monday 17 April 2006 12:34, Matt Feifarek wrote:
Looks like someone's slightly ahead of or behind you. The mktap howto at: http://twistedmatrix.com/projects/core/documentation/howto/mktap.html now reads: This document does not describe current Twisted best practice. The progress of this document is currently being tracked in issue 1139. The docs also suggest: The majority of users will use the .tac Python configuration files without needing to use the mktap serialization. This is certainly my preferred method, and I think that of most developers. I believe mktap was merely an attempt to expose the same functionality with higher-level tools. But take it with a grain of salt; I'm far, far from the inner circle. I'm just regurgitating lore I've picked up from this list to help conserve the attention of the wizards.
So, if the docs tell us that this way is the way to use twisted, and they're wrong, where do we go to learn how to use twisted?
Never hurts to ask the list, just as you've done. I think it's likely your questions have already resulted in attempts to improve the situation. Mike.

On Mon, 17 Apr 2006 12:53:29 -0400, Mike Pelletier <mike@mkp.ca> wrote:
On Monday 17 April 2006 12:34, Matt Feifarek wrote:
Yep. Really good question/answer threads are often useful enough to be turned into documentation themselves. Several of the better Twisted documents, if I recall correctly, were created in just this way. It always seems easier to reply to an email than to sit down and design a document from scratch.

On 4/17/06, Matt Feifarek <matt.feifarek+twisted@gmail.com> wrote:
Please point us at the docs that are wrong (hopefully in the bug tracker), and give them the "documentation" keyword. -- Christopher Armstrong International Man of Twistery http://radix.twistedmatrix.com/ http://twistedmatrix.com/ http://canonical.com/

On 4/17/06, Christopher Armstrong <radix@twistedmatrix.com> wrote:
Please point us at the docs that are wrong (hopefully in the bug tracker), and give them the "documentation" keyword.
According to that page: http://twistedmatrix.com/projects/core/documentation/howto/mktap.html It's already in the tracker (1139). When I click through, I don't end up there, but those links have never worked for me. I always get kicked back to the menu. It's also hard for us users of the libraries to know how to mark bugs for things like "this isn't the right way to use twisted" if we don't know what the right way is. I like Mike's suggestion, though; to stick with .tac and ditch the persistence for now.

On Monday 17 April 2006 13:56, Matt Feifarek wrote:
There is a typo in the URL, it's actually: http://twistedmatrix.com/trac/ticket/1139 (Typo has been noted in the ticket.) Mike.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Mike Pelletier wrote:
It's not actually a typo, it's a broken redirect, http://twistedmatrix.com/bugs/ redirects unconditionally to http://twistedmatrix.com/trac/report which breaks links to bugs all over the place, including mailing list archives. There is a patch attached to ticket #1517 which fixes this, but I don't know what the status of that patch is in regards to our website maintainer. - -David -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) iD8DBQFERDpQrsrO6aeULcgRAsv7AJ93P+GboziEJLfoFOaLVGD4cgTxtwCeJg5w hOVL/jy0MJUH/xvuQZoO18o= =T7TP -----END PGP SIGNATURE-----
participants (6)
-
Christopher Armstrong
-
David Reid
-
glyph@divmod.com
-
Matt Feifarek
-
mcmillen@cs.cmu.edu
-
Mike Pelletier