Output from 0.6.3
centos7
Nomad seems to escape && when using multiple arguments. For my use case, I need to run few python modules in order. This is done in docker-compose as follow:
command: >
bash -c "python -m module_a &&
python -m module_b &&
python -m module_c"
Similarly, in my Nomad job, I passed these modules as arguments:
command = "/bin/bash"
args = ["-c", "python -m module_a", "&&","
"python -m module_b", "&&",
"python -m module_c"]
However, when I run my job it runs module_a, and issue exit code 0. Nomad then restart the job, and rerun module_a, and enters a loop. It seems to escape &&, and ignore the rest of the arguments:
10/20/17 10:22:15 EDT Restarting Task restarting in 18.277681215s
10/20/17 10:22:15 EDT Terminated Exit Code: 0
10/20/17 10:22:11 EDT Started Task started by client
10/20/17 10:21:55 EDT Restarting Task restarting in 16.186283945s
10/20/17 10:21:55 EDT Terminated Exit Code: 0
10/20/17 10:21:51 EDT Started Task started by client
10/20/17 10:21:36 EDT Restarting Task restarting in 15.145157341s
10/20/17 10:21:36 EDT Terminated Exit Code: 0
10/20/17 10:21:32 EDT Started Task started by client
10/20/17 10:21:13 EDT Restarting Task restarting in 18.282284077s
I know this is a desired behavior, but I don't understand why the rest of the arguments are being ignored. Is there a workaround for this?
Can you paste the exact args you're using? There seems to be a trailing " on the first line of your paste.
Have you tried putting all of the arguments after "-c" into a single string? I believe this behave as you intend:
command = "/bin/bash"
args = ["-c", "python -m m1 && python -m m2 && python -m m3"]
I'm going to close for now, but feel free to reopen if bash quoting was not the issue!
Most helpful comment
Can you paste the exact args you're using? There seems to be a trailing
"on the first line of your paste.Have you tried putting all of the arguments after
"-c"into a single string? I believe this behave as you intend: