[Web-SIG] Web Site Process Bus

Graham Dumpleton graham.dumpleton at gmail.com
Thu Jun 28 06:44:02 CEST 2007


On 28/06/07, Robert Brewer <fumanchu at amor.org> wrote:
> Phillip J. Eby wrote:
> > Meanwhile, if you get a start call, you must be starting, right?
> > So why worry about the state?  It'd be simpler to just use
> > "before/during/after" messages the way Twisted does.  Your "block"
> > example could be replaced by waiting for the "after" message of the
> > desired state, for example.
>
> and I replied:
> > That's a possible way to go. My intention was to support both 1)
> > examination of the state by external components (for operations other
> > than 'block'--progress meters spring to mind) and 2) restrict
> > some state
> > transitions if necessary; for example, make bus.start() do nothing (or
> > block) unless the state is "STOPPED".
>
> Would it be helpful to just re-use the terms that Twisted does (in
> IReactorCore)? The two structures are very similar:
>
> Twisted                 WSPBus
> -------                 ------
> core.running            bus.state == states.STARTED
> stop()                  stop()
> 'shutdown' events               'stop' channel listeners
> 'startup' events                'start' channel listeners
> run()                           start()

A question about about the idea of bus.start() like event to indicate startup.

Problem with this is that under mod_wsgi the actual web server child
process has possibly started long before a request may come in which
targets a specific WSGI application. This is because loading of a WSGI
application is effectively done by lazy loading, ie., code file only
gets loaded when URL for a request maps to it.

This is different to where a Python based web server is used as
generally one would in the program script load in the WSGI application
before you even start the web server, as you would need to get the
application entry point to be able to construct the fixed URL entry
point for the root. Pylons and Paste may be an exception to this as
not sure at what point it actually will load things.

How do you see being able to handle a startup like event in that case
for a WSGI application when they aren't effectively being preloaded?
How would you notify just that one application when it does finally
get loaded, or do you?

Graham


More information about the Web-SIG mailing list