RE: [Twisted-Python] How do I get at the Application object (usin g twistd)

Hmmm... I take your point. But... I was looking at doing it at the Application level because that seemed to fit with how twisted.names works. The full configuration of the DNS server, including all the name<->address mapping, is in the dns.tap file. When the server is stopped, this is saved in the dns-shutdown.tap file. So, if I apply some updates, then shut the server down, I can restart the server complete with updates by using dns-shutdown.tap. What I wanted to do was utilize that mechanism rather than do my own serializing, and have to manage two configuration files. Perhaps the question changes to: How do I separate the application data (DNS config) from the rest of the application? How do I start the application using that separate data? It looked so elegant just to re-use the shutdown code! Jeff

On Thu, Feb 03, 2005 at 09:12:30AM -0000, Jeff.Silver@edl.uk.eds.com wrote:
It looked so elegant just to re-use the shutdown code!
But it's not reliable. If the computer crashes while the server is still running, you may not be able to save state. If your codebase changes and you can't unpickle it, or you want to edit configuration on a computer without Twisted or Python installed, or... you get the idea. It's better to just write your app-specific configuration to a text file every N minutes, and then re-read that file on startup. It may not seem as cool or fun or interesting, but it will save you a lot of headaches in the long run. -- Alex Levy WWW: http://mesozoic.geecs.org/ "Never let your sense of morals prevent you from doing what is right." -- Salvor Hardin, Isaac Asimov's _Foundation_

On Thu, Feb 03, 2005 at 09:12:30AM -0000, Jeff.Silver@edl.uk.eds.com wrote:
It looked so elegant just to re-use the shutdown code!
But it's not reliable. If the computer crashes while the server is still running, you may not be able to save state. If your codebase changes and you can't unpickle it, or you want to edit configuration on a computer without Twisted or Python installed, or... you get the idea. It's better to just write your app-specific configuration to a text file every N minutes, and then re-read that file on startup. It may not seem as cool or fun or interesting, but it will save you a lot of headaches in the long run. -- Alex Levy WWW: http://mesozoic.geecs.org/ "Never let your sense of morals prevent you from doing what is right." -- Salvor Hardin, Isaac Asimov's _Foundation_
participants (3)
-
Alex Levy
-
Jeff.Silver@edl.uk.eds.com
-
Tommi Virtanen