How to use the qsub -v command in PBS torque?
Asked Answered
O

1

11

I would like to pass variables to a csh script by using "qsub -v" command. I understand we can list the parameters-value pairs as below,

qsub -v par1=value1 par2=value2 myScript.csh

Does anyone know if the values of these parameters can be a string, a list of numerical numbers separated by comma sign or a filename ? for example, is the command below possible ?

qsub -v par1='Cassie_score' par2=cassieFile.txt par3='100,200,300,' myScript.csh

Thank you very much,

Overact answered 18/10, 2012 at 21:40 Comment(0)
D
13

They just need to be comma-separated:

qsub -v var1="val1",var2=1,var3=val3 script.csh

For your example that'd be:

qsub -v par1='Cassie_score',par2=cassieFile.txt,par3='100,200,300,' myScript.csh

Just note that this wouldn't move cassieFile.txt to the node that will run the job, so cassieFile.txt would need to be a path to a location on a shared filesystem.

Dardanus answered 18/10, 2012 at 22:20 Comment(4)
If I'm not mistaken, @Dardanus is the person who (basically) wrote the code that parses this option in torque >= version 4.Pigheaded
WOW~ Cool~ Thanks a lot. It worked fine with one little problem. When I set par3 as '100,200,300,', myScript.csh can only get the first value 100. I guess it assume that's the separator. Is there any way to make sure the variable par3 get the rest of string ? (The string will be used as input setting for some model running remotely so the comma separators among these 3 values can not be changed. I have no control about the format of the string.) Thank you very much,Overact
I eventually used space delimiter to separate the numbers in the string and add the comma back on.Overact
@Cassie: If you don't specify a value, the value will be copied from the environment. You can use this to get a comma-separated value through: setenv par3 100,200,300; qsub -v par1='Cassie_score',par2=cassieFile.txt,par3 myScript.csh.Fanchie

© 2022 - 2024 — McMap. All rights reserved.