Sbatch: pass job name as input argument

梦想与她 提交于 2019-12-04 02:42:08

The SBATCH directives are seen as comments by the shell and it does not perform variable substitution on $3. There are several courses of action:

Option 1: pass the -J argument on the command line:

sbatch -J thejobname submission_script.sh input.data output.res

Option 2: pass the script through stdin replacing the position arguments ($1, $2, etc. by named ones)

IN=input.data OUT=output.res NAME=thejobname <submission_script.sh sbatch 

Option 3: write a wrapper

#!/bin/bash
sbatch <<EOT
#!/bin/sh
#SBATCH -J $3 #job_name 
#SBATCH -n 1 #Number of processors
#SBATCH -p CA 

nwchem $1 > $2
EOT

and use it like this:

submit.sh input.data output.red thejobname

Also note that the second shebang (#!/bin/bash) is useless and ignored by the (parent) shell.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!