Reputation: 101
I have a Python script that I would like to run on sun grid engine, and this script accepts a string command line argument that might contain braces. For instance, the script could be script.py
:
import sys
print(sys.argv[1])
If I run python script.py aaa{
the output is aaa{
, and if I run python script.py aaa{}
the output is aaa{}
. These are both the desired behavior.
However, if I run qsub -b y -cwd python script.py aaa{
the job fails with error Missing }.
, and if I run qsub -b y -cwd python script.py aaa{}
the job succeeds but outputs aaa
. This is not the desired behavior.
My hypothesis is that qsub does some preprocessing of the command line arguments to my script, but I don't want it to do this. Is there any way to make qsub pass command line arguments to my script as is, regardless of whether they contain braces or not?
Upvotes: 0
Views: 771
Reputation: 101
I was able to solve my problem by running qsub -b y -cwd -shell no python script.py aaa{}
instead of qsub -b y -cwd python script.py aaa{}
. On my system, -shell yes
seemed to be enabled by default, which initiated some preprocessing. Adding -shell no
appears to fix this.
Upvotes: 0
Reputation: 2830
The simplest solution would be to use
echo "python script.py aaa{}" | qsub -cwd
You could also create submit file containing the following:
#!/bin/bash
#$ -cwd
python ./script.py ${input}
Then, you can pass your input via qsub -v input=aaa{} script.submit
Both variants require to omit -b y
.
Upvotes: 0