I have access to a cluster using slurm and want to extend it to use python for sbatch submission scripts. How do I do that?
I tried giving my submission script different paths to the interpreter:
#!/bin/python
#!/usr/bin/python
#!/usr/bin/env python
with no success in any of them. How do I activate this feature in my cluster?
For completion here is my test submission script:
#!/usr/bin/env python
#SBATCH --mail-type=ALL
#SBATCH --mail-user=rene_sax14@yahoo.com
#SBATCH --array=1-1
#SBATCH --partition=gpux1
import sys
print(sys.version)
print(sys.path)
def helloworld():
print('Hello World')
if __name__ == '__main__':
print('---> DONE')
Error message:
cat slurm-968_1.out
import: unable to open X server `' @ error/import.c/ImportImageCommand/369.
/var/spool/slurm/d/job00968/slurm_script: line 19: syntax error near unexpected token `sys.version'
/var/spool/slurm/d/job00968/slurm_script: line 19: `print(sys.version)'
$ cat python_sub_script.py
#!/bin/python3.6
#SBATCH --mail-type=ALL
#SBATCH --mail-user=rene_sax14@yahoo.com
#SBATCH --array=1-1
#SBATCH --partition=gpux1
import sys
print(sys.version)
print(sys.path)
def helloworld():
print('Hello World')
if __name__ == '__main__':
print('---> DONE')
I did check this time if there was a python3.6
at bin so that is not the issue check it out:
$ ls -lah /bin/python3.6
-rwxr-xr-x 2 root root 67K Aug 7 2019 /bin/python3.6
related/crossposted: