我有一个按顺序运行多个Python脚本的应用程序。我可以在码头上运行它们,如下所示:
command: >
bash -c "python -m module_a &&
python -m module_b &&
python -m module_c"现在,我在Nomad中调度作业,并在configuration驱动程序下添加了以下命令:
command = "/bin/bash"
args = ["-c", "python -m module_a", "&&","
"python -m module_b", "&&",
"python -m module_c"]但是Nomad似乎摆脱了&&,只运行第一个模块,并发出退出代码0。有任何方法来运行类似于的多行命令吗?
发布于 2017-10-20 04:25:00
保证以下内容与exec驱动程序一起工作:
command = "/bin/bash"
args = [
"-c", ## next argument is a shell script
"for module; do python -m \"$module\" || exit; done", ## this is that script.
"_", ## passed as $0 to the script
"module_a", "module_b", "module_c" ## passed as $1, $2, and $3
]注意,只有一个参数作为脚本传递--紧跟在-c后面的那个。后续参数是该脚本的参数,而不是附加脚本或脚本片段。
更简单的是,您可以运行:
command = "/bin/bash"
args = ["-c", "python -m module_a && python -m module_b && python -m module_c" ]https://stackoverflow.com/questions/46841878
复制相似问题