Hi Giuseppe, On Thu, Jun 30, 2022 at 09:10:15AM +0100, Giuseppe Congedo wrote:
job.setExecutable('/bin/tar -xvzf myenv.tar.gz && source myenv/bin/activate')
but hit two issues due to '&&' and 'source'. Which shell do the nodes use?
DIRAC launches the executable directly without a shell, which is probably why you're seeing problems. In the above it'll just run tar and pass everything else as arguments to that. The easiest way is probably to include the shell you want as part of the command: job.setExecutable('tar xvzf myenv.tar.gz') job.setExecutable('/bin/bash -c "source myenv/bin/activate && more-commands..."') The problem with the above is that it can easily become quite unreadable if you have a lot of commands to run in the environment. A neater (and more common) way to achieve this is to include a simple wrapper script that does all of the set-up commands and put that in the input sandbox too (it'll be uploaded when you submit the job): $ cat wrapper.sh #!/bin/bash tar xvzf myenv.tar.gz source myenv/bin/activate ... python my_main_script.py "${@}" job.setInputSanbox(["wrapper.sh", "LFN:/.../myenv.tar.gz"]) job.setExecutable('/bin/bash wrapper.sh specific_args_for_this_job') Regards, Simon