[英]Command line arguments not being passed in sbatch
I am trying to submit a job using the SLURM job scheduler and am finding that when I use the --export=VAR=VALUE
syntax then some of my variables are not being passed (often the variable in the first instance of export
). 我试图使用SLURM作业计划程序提交作业,并且发现当我使用--export=VAR=VALUE
语法时,我的某些变量没有被传递(通常是在export
的第一个实例中)。 My understanding is that I need to specify --export=...
for each variable, eg 我的理解是,我需要为每个变量指定--export=...
,例如
sbatch --export=build=true --export=param=p100_256 run.py
My script "run.py" looks like this: 我的脚本“ run.py”如下所示:
#! /usr/bin/env python
import os,fnmatch
print(os.environ["SLURM_JOB_NAME"])
print(os.environ["SLURM_JOB_ID"])
print(fnmatch.filter(os.environ.keys(),"b*"))
print(fnmatch.filter(os.environ.keys(),"p*"))
I'd prefer to submit a python script as all of my existing scripts (used previously with PBS) are already in python and I don't want to have to rewrite them in shell scripts. 我宁愿提交一个python脚本,因为所有现有脚本(以前与PBS一起使用)已经在python中,并且我不想用shell脚本重写它们。 My problem is best demonstrated through a short example. 我的问题最好通过一个简短的例子来说明。
Firstly, 首先,
> sbatch --export=build=true --export=param=p100_256 run.py
> Submitted batch job 2249581
produces a log file with the following: 生成具有以下内容的日志文件:
run.py
2249581
[]
['param']
If I reverse the order of the export
flags for 'build' and 'param', 如果我反转“ build”和“ param”的export
标志的顺序,
> sbatch --export=param=true --export=build=p100_256 run.py
> Submitted batch job 2249613
then the log file now looks like, 那么日志文件现在看起来像
run.py
2249613
['build']
[]
which would suggest that only the final instance of the export
flag is being passed. 这表明仅传递了export
标志的最终实例。 If I add in a third instance of export
, 如果我添加了export
的第三个实例,
> sbatch --export=param=1 --export=build=p100_256 --export=build_again=hello run.py
> Submitted batch job 2249674
then the log file returns, 然后日志文件返回,
run.py
2249674
['build_again']
[]
So does anybody know why only the final instance of export
is being passed? 那么,有人知道为什么仅通过export
的最终实例吗? Have I got the syntax incorrect? 我的语法有误吗? Do I need to specify an additional flag? 我是否需要指定其他标志?
Thanks! 谢谢!
Yes, looks like I had the syntax incorrect. 是的,看起来我的语法不正确。 I missed in the documentation that additional variables should be comma separated and specified with a single export
flag, eg 我在文档中错过了其他变量应该用逗号分隔并用单个export
标志指定的示例,例如
> sbatch --export=build=true,param=p100_256 run.py
So previous instances of export
must be being replaced each time export
is specified. 如此以往实例export
必须每次都被替换export
指定。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.