Discussion:
[Supervisor-users] use environment variable expansion on numprocs, possible?
Alfredo Di Napoli
2015-05-10 08:20:49 UTC
Permalink
Hello everyone,

I have switched to supervisor only recently and I’m getting myself
acquainted.

Something I would like to do is to externally pass the value for numproc,
under the form of an environment variable, like so:

[
]
numprocs_start=0
numprocs=%(ENV_HERMES_INSTANCES)01d
[
]

But it doesn’t seem to work the way I expected:

$ supervisorctl reread
ERROR: CANT_REREAD: invalid literal for long() with base 10:
'%(ENV_HERMES_INSTANCES)01d’

Thus my question: Is it possible at all? If yes, how?

Thank you very much!

Alfredo
Aryeh Leib Taurog
2015-05-10 08:45:23 UTC
Permalink
I believe only certain configuration settings allow interpolation.
The documentation states which they are. Do a search for 'string
expression' on this page: <http://supervisord.org/configuration.html>

numprocs doesn't seem to be one of them.

Perhaps you could generate a config file dynamically, setting numprocs
appropriately, then add process group.
Post by Alfredo Di Napoli
Hello everyone,
I have switched to supervisor only recently and I’m getting myself
acquainted.
Something I would like to do is to externally pass the value for numproc,
[…]
numprocs_start=0
numprocs=%(ENV_HERMES_INSTANCES)01d
[…]
$ supervisorctl reread
'%(ENV_HERMES_INSTANCES)01d’
Thus my question: Is it possible at all? If yes, how?
Thank you very much!
Alfredo
_______________________________________________
Supervisor-users mailing list
https://lists.supervisord.org/mailman/listinfo/supervisor-users
Alfredo Di Napoli
2015-05-10 08:55:04 UTC
Permalink
Thanks, it's what I feared.

Yes, eventually I resorted in doing a hacky runtime sed substitution after sourcing /etcprofile, as such value is acquired from EC2 tags only after the machine startup, and thus cannot be easily generated programmatically from a template.

Thanks anyway,

Alfredo

Sent from my iPad
Post by Aryeh Leib Taurog
I believe only certain configuration settings allow interpolation.
The documentation states which they are. Do a search for 'string
expression' on this page: <http://supervisord.org/configuration.html>
numprocs doesn't seem to be one of them.
Perhaps you could generate a config file dynamically, setting numprocs
appropriately, then add process group.
Post by Alfredo Di Napoli
Hello everyone,
I have switched to supervisor only recently and I’m getting myself
acquainted.
Something I would like to do is to externally pass the value for numproc,
[…]
numprocs_start=0
numprocs=%(ENV_HERMES_INSTANCES)01d
[…]
$ supervisorctl reread
'%(ENV_HERMES_INSTANCES)01d’
Thus my question: Is it possible at all? If yes, how?
Thank you very much!
Alfredo
_______________________________________________
Supervisor-users mailing list
https://lists.supervisord.org/mailman/listinfo/supervisor-users
Loading...