On Mon, Oct 1, 2012 at 12:23 AM, Roy Smith <r...@panix.com> wrote: > In article <mailman.1672.1349011558.27098.python-l...@python.org>, > Chris Angelico <ros...@gmail.com> wrote: > >> there's no efficient and reliable way to change/reload code in a >> running application (not often an issue). > > What we do (largely cribbed from django's runserver) is start up a > thread which once a second, looks at all the modules in sys.modules, > checks to see if the modification time for their source files has > changed, and if so, restarts the application. This is hugely convenient > when developing any kind of long-running application. You don't need to > keep restarting the application; just edit the source and changes take > effect (almost) immediately. > > Not sure if this is what you had in mind.
It's not an _explicit_ restart, but you have to write your application to keep all its state on disk in some way. What I'm talking about is having a single process that never terminates, never stops accepting connections, but at some point new connections begin to be served with new code - with old ones, if they're still going, continuing to be handled by the old code. I have one such process that's been going for (let me check) 115 wk 0d 21:05:21. For many types of application, restarting is perfectly viable, so this isn't a major issue with Python. ChrisA -- http://mail.python.org/mailman/listinfo/python-list