Hi, as suggested in ticket http://projects.unbit.it/uwsgi/ticket/12

the emperor should be able to use hooks.

The proposal is more advanced than the last committed implementation.

Only a generic start-hook is available (it is run before calling the uwsgi
instance) and the command it run will be executed in the same environemnt
(fds and variables) of the corresponding instance.

A post start-hook should be executed by the instance itself. This could be
useful for other non-emperor stuff.

I would run the post-start-hook soon after app-loading phase.

The --vassals-start-hook is secure as it is executed in the instance space
and will not block the emperor work.

--vassals-stop-hook is less secure as it will block the emperor. So it
must do fast and cheap operations. If you put a sleep on it, even the
emperor will sleep.

As post-start, a pre-stop could be implemented in the instance itself.

In both --vassals-start-hook and --vassals-stop-hook the config file is
reported as the first argument. There is no way to parse the file contents
in the emperor and pass it to the instances (it would require a massive
refactoring of the config system) but (obviously) the script/command can
parse the file in all the way it want.

The option --parse (still unimplemented) could be very useful for this
kind of task:

#!/bin/sh

UWSGI_CONFIG_FILE=$1
UWSGI_SOCKET = `uwsgi --parse $1:socket`

echo $UWSGI_SOCKET


I will leave the ticket opened until all of the pieces will be available.

-- 
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to