[Grok-dev] Re: zopectl autorestart

Peter Bengtsson peter at fry-it.com
Mon Jun 9 11:11:42 EDT 2008


I've studied how django does this. It starts a thread that loops in
infinity for a mtime changes to files in sys.modules.values(). It does
this for about 250 files every 1 second which might sound like a lot
but it doesn't even appear in top. inotify is a much more powerful way
but I don't want to bully osx and windows users.

2008/6/9 Peter Bengtsson <peter at fry-it.com>:
> I've managed to hack zc.zope3recipes.ctl to accept another program
> called "autorestart". You run it like this::
>
>  $ ./bin/zopectl autorestart src/mymodule
>
> It will then start an inotify watcher to watch all .py files (except
> tests) and .pt files that define a macro and whenever it spots a
> change it restarts Zope. Restart on my laptop takes 2.5 seconds which
> is annoying this beats the hell out of having to switch console,
> Ctrl-C, arrow up, hit Enter, wait. I heard rumors of running Grok on
> paster serve but nothing has been done there yet. Django already does
> this except its restarts are < 1 sec and I haven't looked at how they
> actually do it under the hood.
>
> A couple of questions::
>
>  1. Who can help me review this patch into zc.zope3recipes?
>
>  2. Does inotify work on the OSX? (which I care about unlike Windows)
>
>  3. Has anybody ever used Gamin [1] (...which I found quite useless
> compared to pyinotify)?
>
>
>
> [1] http://www.gnome.org/~veillard/gamin/index.html
>
> --
> Peter Bengtsson,
> work www.fry-it.com
> home www.peterbe.com
> hobby www.issuetrackerproduct.com
>



-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


More information about the Grok-dev mailing list