wgnet / twoost

Tools for Twisted
5 stars 3 forks source link

Running twoost with supervisor #3

Open xdrew opened 8 years ago

xdrew commented 8 years ago

Is there an easy way of managing twoost pids with supervisor instead of built in manager?

anjensan commented 8 years ago

Could you describe in more details your use-case? PS: This repo isn't active. I suggest you to create any bugs directly in my fork repo.

xdrew commented 8 years ago

In brevity: sometimes worker spawned by geininit just hangs and looses its pid connection, so it says it's still working in health check but doesn't relate to any pid. I have no idea how it is possible, but supervisor seems to be better solution for process managing.

anjensan commented 8 years ago

I can try to fix such bug, but it's hard to do without concrete details. Also I can add some supervisor-like functionality to geninit. At least integration with 'twistd procmon' seems reasonable for me.

If you prefer to use external supervisor (supervisord for example) you still can use the Twoost except geninit module. Simplest way how to do it: 1) Just don't use AppWorker, put application configuration code into tac file. 2) Run your application with command 'twistd -n -y ' 3) Don't forget to redefine some twoost settings. For example 'TWOOST_WORKDERID' environment variable typically provided by geninit -- you need to define it manually. Here is an example (for demoapp-storage worker) https://gist.github.com/anjensan/b5c8588c2dbc17747d78359281f0429c