简体   繁体   English

将SLURM批处理命令行参数传递给R

[英]Passing SLURM batch command line arguments to R

I'm trying to run a SLURM sbatch command with various parameters that I can read in an R script. 我正在尝试使用可以在R脚本中读取的各种参数来运行SLURM sbatch命令。 When using PBS system, I used to write qsub -v param1=x,param2=y (+ other system parameters like the memory requirements etc and the script name to be read by PBS) and then in the R script read it with x = Sys.getenv('param1') . 当使用PBS系统时,我曾经写过qsub -v param1=x,param2=y (+其他系统参数,例如内存要求等和PBS要读取的脚本名称),然后在R脚本中用x = Sys.getenv('param1')读取x = Sys.getenv('param1')

Now I tried 现在我尝试

sbatch run.sh --export=basePath=‘a’

With run.sh: 使用run.sh:

#!/bin/bash

cd $SLURM_SUBMIT_DIR
echo $PWD

module load R/common/3.3.3

R CMD BATCH --quiet --no-restore --no-save runDo.R output.txt

And runDo.R: 并运行:

base.path = Sys.getenv('basePath')

print(base.path)

The script is running but the argument value is not assigned to base.path variable (it prints an empty string). 脚本正在运行,但是参数值未分配给base.path变量(它输出一个空字符串)。

The export parameter has to be passed to sbatch not to the run.sh script. 必须将export参数传递给sbatch,而不是传递给run.sh脚本。

It should be like this: 应该是这样的:

sbatch --export=basePath=‘a’ run.sh

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM