stavinsky / supervisord-touch-reload

Very basic script used to add "touch-reload" like in uwsgi to supervisord
MIT License
8 stars 0 forks source link

Fault 10: BAD_NAME #2

Open hackel opened 7 years ago

hackel commented 7 years ago

When firing up touch_reload, it is monitoring my directory fine, but whenever I change a file, it logs this error:

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "build/bdist.linux-x86_64/egg/touch_reload/__main__.py", line 3, in <module>
  File "build/bdist.linux-x86_64/egg/touch_reload/__init__.py", line 108, in main
  File "build/bdist.linux-x86_64/egg/touch_reload/event_listener/event_listener.py", line 37, in start_loop
  File "build/bdist.linux-x86_64/egg/touch_reload/__init__.py", line 86, in on_event
  File "build/bdist.linux-x86_64/egg/touch_reload/__init__.py", line 79, in action
  File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/dist-packages/supervisor/xmlrpc.py", line 497, in request
    return u.close()
  File "/usr/lib/python2.7/xmlrpclib.py", line 800, in close
    raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault 10: 'BAD_NAME: program-name'>

Obviously I have ensured that my "program-name" is correct. It is specified as: [program:program-name], and this works fine to start/stop the supervisor process. I'm running supervisor 3.2.0, in case something changed with their API.

Edit: I think I figured it out. I am running multiple processes and using process_name=%(program_name)s_%(process_num)02d, and this is what the supervisor.stopProcess method must be expecting. In my case, it would need to use stopProcessGroup, apparently. Perhaps it would make sense to add a --program-group option to account for this scenario.

stavinsky commented 7 years ago

Thank you. I'll try to fix it. Can you show me you supervisord config file or make sample with same issue?

hackel commented 7 years ago

Sure, here it is. FYI, just changing it to use {stop,start}ProcessGroup worked just fine.

[program:program-queue-worker]
process_name=%(program_name)s_%(process_num)02d
directory=/home/program
command=php artisan queue:work --delay=10 --sleep=10 --tries=1
autostart=true
autorestart=true
user=program
umask=0002
numprocs=4
redirect_stderr=true
stdout_logfile=/home/program/storage/logs/queue-worker.log
stdout_logfile_maxbytes=2MB
stdout_logfile_backups=2

[eventlistener:test_listener]
command = python -m touch_reload --socket unix:///var/run/supervisor.sock --file app --program program-queue-worker
events = TICK_5
directory = /home/program
#stderr_logfile = /tmp/test_listener.log
stderr_logfile = NONE