Supervisor / supervisor

Supervisor process control system for Unix (supervisord)
http://supervisord.org
Other
8.33k stars 1.23k forks source link

BAD_NAME when calling startProcess #1605

Closed streamingsystems closed 6 months ago

streamingsystems commented 8 months ago

Hi,

I am sure this is something simple but I have been wrestling with it for a few hours and can't figure it out.

I have a conf file like this that has 5 processes running:

[program:hostname] process_name=%(programname)s%(process_num)02d command=foo.sh autostart=false autorestart=true numprocs=5 redirect_stderr=true stdout_logfile=/var/log/supervisor/%(program_name)s.log stopwaitsecs=7200 stopasgroup=true killasgroup=true

From the XML RPC Api I would like to start one (or more) processes in addition to the 5 that are running.

// Trying to figure out the naming

$process = $supervisor->startProcess('hostname:hostname_00'); // ALREADY_STARTED: hostname:hostname_00

$process = $supervisor->startProcess('hostname:hostname_01'); // ALREADY_STARTED: hostname:hostname_01

$process = $supervisor->startProcess('hostname:hostname_02'); // ALREADY_STARTED: hostname:hostname_02

$process = $supervisor->startProcess('hostname:hostname_03'); // ALREADY_STARTED: hostname:hostname_03

$process = $supervisor->startProcess('hostname:hostname_04'); // ALREADY_STARTED: hostname:hostname_04

// Based on the testing above (e.g. names of the processes I would think this should work

$process = $supervisor->startProcess('hostname:hostname_05'); // BAD_NAME: hostname:hostname_05

I tried different combinations for the 'name' parameter passed into the startProcess method and can't figure out the naming convention should use or if it's even possible for me to start a new process from this "hostname" group using the XML API.

My goal is to, for example, write a loop that might start 05 -> 10 (or more) processes in real time while keeping the processes that are already running (as they will be servicing long running processes).

Of course, when supervisord is restarted it will go back to the 5 that are part of the initial conf, but I am looking for the ability to start up processes for this group at will from the API at runtime.

Thanks for your help.

-Rob

streamingsystems commented 8 months ago

OK I think that maybe I am understanding it better. It seems that maybe I need to not set "autostart" and just set numprocs a really high number (e.g. the most processes we would event run) and then just manually start the processes one by one up to what we want initially and then start more as we go.

It's like somehow the numprocs when supervisor is started is the max that can be started during that session.

streamingsystems commented 8 months ago

So I am going to do it the way I mentioned above and set numprocs to a high number and start he processes manually via the API.

I am assuming even if we have a high number for numprocs it's not really taking much resources (if the processes are not running) just maybe part of an array in memory.

mnaberez commented 6 months ago

Duplicate of #177