I want to start a calculation on a HPC system (Linux; slurm) via batch file. When I log in via a remote client (MobaXterm) and start the batch file with the command sbatch start.sh
everything is executed as planned. But if I connect via Python script (using Paramiko) I get the error message
ansys221: command not found
for a module loaded in the batch file.
My conclusions:
- The ssh connection is working as it should (datatransfer to filesystem on hpc works)
- The sbtach command starts the right batch-file (the selected job name appears in the job queue)
- The modules are available on the hpc system (batch file starts calculation correctly when run via MobaXterm)
I use the following Python code:
from paramiko import SSHClient
client = SSHClient()
client.load_system_host_keys()
client.connect(url, username, password)
ssh_stdin, ssh_stdout, ssh_stderr = client.exec_command(sbatch start.sh)
ssh_stdout.channel.recv_exit_status()
lines = ssh_stdout.readlines()
for line in lines:
print(line)
client.close()
Why does different behavior appear when the batch file is started via ssh connection?