gpt4 book ai didi

dotcloud supervisord.conf 文件环境规范

转载 作者:行者123 更新时间:2023-12-02 00:21:45 24 4
gpt4 key购买 nike

http://docs.dotcloud.com/guides/daemons/状态:

Configuring The Environment
You can easily modify the environment of execution of your daemon with the “directory” and “environment” directives to change the directory where the command is executed and to define additional environment variable. For example:

[program:daemonname]
command = php my_daemon.php
directory = /home/dotcloud/current/
environment = QUEUE=*, VERBOSE=TRUE

但是,我发现我的 PYTHONPATH 环境变量没有被设置:

点云.yml:

www:
type: python
db:
type: postgresql
worker:
type: python-worker

supervisord.conf:

[program:apnsd]
command=/home/dotcloud/current/printenv.py
environment=PYTHONPATH=/home/dotcloud/current/apnsd/

打印环境

#! /home/dotcloud/env/bin/python
import os
print "ENVIRONMENT"
print os.environ

日志:

    ENVIRONMENT
{'SUPERVISOR_ENABLED': '1', 'SUPERVISOR_SERVER_URL': 'unix:///var/dotcloud/super
visor.sock', 'VERBOSE': 'no', 'UPSTART_INSTANCE': '', 'PYTHONPATH': '/', 'PREVLE
VEL': 'N', 'UPSTART_EVENTS': 'runlevel', '/': '/', 'SUPERVISOR_PROCESS_NAME': 'a
pnsd', 'UPSTART_JOB': 'rc', 'PWD': '/', 'SUPERVISOR_GROUP_NAME': 'apnsd', 'RUNLE
VEL': '2', 'PATH': '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
', 'runlevel': '2', 'previous': 'N'}

不显示修改过的 python 变量!

最佳答案

Supervisor 有一个bug;一些变量(比如那些包含 / 的变量)必须被引用。

在这种情况下,您需要:

[program:apnsd]
command=/home/dotcloud/current/printenv.py
environment= PYTHONPATH="/home/dotcloud/current/apnsd/"

(= PYTHONPATH 中的空格不是强制性的,它只是为了使文件稍微更具可读性;但是,PYTHONPATH 值周围的引号是必需的! )

我将更新 dotCloud 的文档以提及此问题。

关于dotcloud supervisord.conf 文件环境规范,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10653590/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com