2

我想向网格提交 R 作业。我已将主要 R 代码保存在我编写MGSA_rand.r 的文件中callmgsa.r

print('here')
source('/home/users/pegah/MGSA_rand.r')
mgsalooprand($SGE_TASK_ID,382)

我使用文件Rscript.sh来调用作业(使用-t参数我发送对应的值$SGE_TASK_ID)

R CMD BATCH --no-save callmgsa.r

我这样提交工作:

qsub -t 1 -cwd -b y -l  vf=1000m /home/users/pegah/Rscript.sh  

我既没有收到错误也没有任何输出。作业在我提交时终止,没有任何输出。请你帮助我好吗?
谢谢,佩加

4

1 回答 1

0

该变量$SGE_TASK_ID是一个shellscript变量。用相同的语法在 R 中调用它是行不通的。你可以做的是使用Rscript。从您调用的 shellscript 中:

Rscript callmgsa.r $SGE_TASK_ID

在 R 脚本中,您可以捕获命令行参数,例如:

args <- commandArgs(trailingOnly = TRUE)
print('here')
source('/home/users/pegah/MGSA_rand.r')
mgsalooprand(args[1],382)

这应该工作...

于 2012-02-19T13:21:49.527 回答