Supervisor/supervisor

BAD_NAME when calling startProcess

Closed this issue · 3 comments

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=%(program_name)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

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.

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.

Duplicate of #177