You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello again, it doesn't appear that all environment variables defined in the config are parsed at the right time.
When using $(circus.env.<name>) for defining numprocesses, this only works when an environment variable is defined before running Circus, not when it's configured in the INI file in the [env:<name>] section. I can confirm this problem is present on the master branch of GitHub right now.
See below for an example.
(fastapi-deploy) [fots@workstation fotsies-fastapi-deploy-config]$ cat circus.ini
[watcher:app]
cmd = bash -c 'echo number is set to $number'
numprocesses = $(circus.env.number)
[env:app]
number = 8
(fastapi-deploy) [fots@workstation fotsies-fastapi-deploy-config]$ number=10 circusd circus.ini
2020-09-14 12:15:34 circus[100942] [INFO] Starting master on pid 100942
2020-09-14 12:15:34 circus[100942] [INFO] Arbiter now waiting for commands
number is set to 8
number is set to 8
number is set to 8
number is set to 8
number is set to 8
number is set to 8
number is set to 8
number is set to 8
number is set to 8
2020-09-14 12:15:34 circus[100942] [INFO] app started
number is set to 8
^C2020-09-14 12:15:34 circus[100942] [INFO] Got signal SIG_INT
2020-09-14 12:15:34 circus[100942] [INFO] Arbiter exiting
2020-09-14 12:15:34 circus[100942] [INFO] app stopped
(fastapi-deploy) [fots@workstation fotsies-fastapi-deploy-config]$ circusd circus.ini
Traceback (most recent call last):
File "/home/fots/.virtualenv/fastapi-deploy/bin/circusd", line 11, in <module>
load_entry_point('circus==0.16.1', 'console_scripts', 'circusd')()
File "/home/fots/.virtualenv/fastapi-deploy/lib/python3.8/site-packages/circus/circusd.py", line 126, in main
arbiter = Arbiter.load_from_config(args.config)
File "/home/fots/.virtualenv/fastapi-deploy/lib/python3.8/site-packages/circus/arbiter.py", line 419, in load_from_config
cfg = get_config(config_file)
File "/home/fots/.virtualenv/fastapi-deploy/lib/python3.8/site-packages/circus/config.py", line 220, in get_config
watcher['numprocesses'] = dget(section, 'numprocesses', 1,
File "/home/fots/.virtualenv/fastapi-deploy/lib/python3.8/site-packages/circus/config.py", line 79, in dget
value = int(value)
ValueError: invalid literal for int() with base 10: '$(circus.env.number)'
This doesn't seem to be a problem for cmd, only for numprocesses:
(fastapi-deploy) [fots@workstation fotsies-fastapi-deploy-config]$ cat circus.ini
[watcher:app]
cmd = bash -c 'echo number is set to $number'
[env:app]
number = 8
(fastapi-deploy) [fots@workstation fotsies-fastapi-deploy-config]$ circusd circus.ini
2020-09-14 12:15:57 circus[101119] [INFO] Starting master on pid 101119
2020-09-14 12:15:57 circus[101119] [INFO] Arbiter now waiting for commands
number is set to 8
2020-09-14 12:15:57 circus[101119] [INFO] app started
^C2020-09-14 12:15:58 circus[101119] [INFO] Got signal SIG_INT
2020-09-14 12:15:58 circus[101119] [INFO] Arbiter exiting
2020-09-14 12:15:58 circus[101119] [INFO] app stopped
Any help is appreciated
Fotis
The text was updated successfully, but these errors were encountered:
Hello again, it doesn't appear that all environment variables defined in the config are parsed at the right time.
When using
$(circus.env.<name>)
for defining numprocesses, this only works when an environment variable is defined before running Circus, not when it's configured in the INI file in the[env:<name>]
section. I can confirm this problem is present on the master branch of GitHub right now.See below for an example.
This doesn't seem to be a problem for
cmd
, only fornumprocesses
:Any help is appreciated
Fotis
The text was updated successfully, but these errors were encountered: