Command line arguments not being passed in sbatch
Question: 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`). My
understanding is that I need to specify `--export=...` for each variable, e.g.

    
    
    sbatch --export=build=true --export=param=p100_256 run.py
    

My script "run.py" looks like this:

    
    
    #! /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. 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',

    
    
    > 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. If I add in a third instance of `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?
Have I got the syntax incorrect? Do I need to specify an additional flag?

Thanks!


Answer: 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, e.g.

    
    
    > sbatch --export=build=true,param=p100_256 run.py
    

So previous instances of `export` must be being replaced each time `export` is
specified.

