下面当我尝试哈希一个列表时,它给了我一个错误但是使用了一个元组.猜猜它与不变性有关.有人可以详细解释一下吗?
名单
x = [1,2,3]
y = {x: 9}
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'
Run Code Online (Sandbox Code Playgroud)
元组
z = (5,6)
y = {z: 89}
print(y)
{(5, 6): 89}
Run Code Online (Sandbox Code Playgroud) 我将endpoints.health.path属性设置为/ping/me.但我无法使用http:// localhost:9000/ping/me访问端点
它只适用于http:// localhost:9000/health.我错过了什么?这是app属性文件中的代码.
#Configuration for Health endpoint
endpoints.health.id=health
endpoints.health.path=/ping/me
endpoints.health.enabled=true
endpoints.health.sensitive=false
#Manage endpoints
management.port=9000
management.health.diskspace.enabled=false
Run Code Online (Sandbox Code Playgroud)
我得到的回应是:
{
"timestamp" : 1455736069839,
"status" : 404,
"error" : "Not Found",
"message" : "Not Found",
"path" : "/ping/me"
}
Run Code Online (Sandbox Code Playgroud) 可以说我在监督中有两个程序.有没有办法有条件地运行第一个程序(后台进程)而不必将其移动到单独的脚本文件?
[supervisord]
nodaemon=true
logfile=/tmp/supervisord.log
#Need this program to run conditionally - say based off an environment variable being set
[program:prog1]
command=/bin/prog1
[program:prog2]
command=/bin/prog2 -DFOREGROUND
Run Code Online (Sandbox Code Playgroud) 使用supervisord,如何在运行程序之前执行命令?
例如,在下面的代码中,我想在启动程序之前创建一个文件.在下面的代码中我使用tail -f/dev/null来模拟后台进程,但这可能是任何正在运行的程序,如'/ path/to/application'.我试过'&&'这似乎不起作用.要求是必须首先创建文件才能使应用程序正常工作.
[supervisord]
nodaemon=true
logfile=~/supervisord.log
[program:app]
command:touch ~a.c && tail -f /dev/null
Run Code Online (Sandbox Code Playgroud)