> On 30.11.2012 18:39, Roberto De Ioris wrote:
>>
>> Thinking about a way to allow users developing emperor plugins faster,
>> i came to the conclusion that exposing a zeromq api would be the best
>> choice.
>>
>> So i committed the emperor_zeromq plugin:
>>
>> https://github.com/unbit/uwsgi/blob/master/plugins/emperor_zeromq/emperor_zeromq.c
>
> So, here's my couch_emperor.py
>
> https://gist.github.com/4212804
>
> Seems to work fine. Connects to couchdb, get's all the documents with
> and sends a touch command for each document with an id ending in '.json'
> that has 'uwsgi' key. It would also listen for changes in the database
> and update the emperor. There might be some corner cases, but the
> emperor itself is smart enough to don't matter.
>
>
> Now there's strange problem. When a vassal is started, and then I just
> touch a document in the couchdb database, but with nothing changed in
> the config, I see the same touch command sent to the emperor, but the
> emperor errors out with "error parsing JSON data".
>
> [emperor] reload the uwsgi instance typical-config-document.json
> Wed Dec  5 07:19:15 2012 - received message 0 from emperor
> SIGINT/SIGQUIT received...killing workers...
> goodbye to uWSGI.
> [emperor] removed uwsgi instance typical-config-document.json
> [emperor] unrecognized vassal event on fd 13
> [emperor] unrecognized vassal event on fd 13
> .... repeated dozens of times ...
> [emperor] unrecognized vassal event on fd 13
> [emperor] unrecognized vassal event on fd 13
> *** has_emperor mode detected (fd: 15) ***
> [uWSGI] getting JSON configuration from
> emperor://typical-config-document.json
> error parsing JSON data: line 1 '[' or '{' expected near end of file
> [emperor] removed uwsgi instance typical-config-document.json
> [emperor] unloyal bad behaving vassal found:
> typical-config-document.json throttling it...
>


Should be improved in latest HEAD.

Some note:

if you create a new instance (passing the config body in the zeromq message)
and you want to reload it without changing the config you can simply do:

['touch','foo.ini']

on empty config, the default rule is using the old one.

The new reloading subsystem is truly graceful, unfortunately the emperor
config protocol changed a bit, so you cannot use <= 1.4 instances behind
1.5 emperor plugins using embedded config (like the postgresql one).

It should not be a big a problem, but it should be reported in the docs.

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

Reply via email to