I'm writing some bash scripts to make easier submitting jobs to a compute cluster using the oar syntax, and for the option I need they say that they use SQL syntax (option -p).
For some context, here is the command I am using:
oarsub -q production -p "GPU = 'GTX 980'" -l "nodes=1,walltime=00:05" -I
Where I want to be able to change the GTX 980 and 00:05 with inputs given by the user.
I have had success with just taking time as an input and leaving the GPU fixed:
oarsub -q production -p "GPU = 'GTX 980'" -l "nodes=1,walltime=$1" -I
I have already tried using double quotes as stated on these answers 1, 2, 3. But it seems like parameter expansion keeps happening with:
echo "$2"
oarsub -q production -p "GPU = "$2"" -l "nodes=1,walltime=$1" -I
manuel@machine$: bash job_script.sh 00:05 'GTX 980'
GTX 980
...
/!\ You asked for an Interactive job SO I will ignore arguments: 980 ; Is your syntax right?
...
[ADMISSION RULE] Job properties : (GPU = GTX) AND maintenance = 'NO'
Generate a job key...
Bad resource request (ERROR: column "gtx" does not exist
LINE 4: ...alltime >= 300 OR max_walltime <= 0)) AND ((GPU = GTX) AND m...
Where it seems like it is not taking the whole 'GTX 980' as a complete string on, but instead is splitting them into 'GTX' and '980', because of the: /!\ You asked for an Interactive job SO I will ignore arguments: 980 ; Is your syntax right?
warning.
Is is a way I could pass the GPU name as a bash input argument to the command? Or it might be some problem between how bash
formats and passes the input to oarsub
?