[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Condor-users] Parsing quoted arguments in Condor



Hi, Dan and others,

Thanks a lot for the help.

On Sat, Dec 6, 2008 at 12:16 AM, Dan Bradley <dan@xxxxxxxxxxxx> wrote:

> Both are leagal but both had the problem that "b_mod -b_op1
> b_op1_value" can't be parsed for "b_mod" further after the whole
> string is treated as one argument for the main program.


Unfortunately, I can't understand your statement above.  All condor can
do is influence the argv[] array that gets passed to main() in your
program.  If the argv that you want is like #1 above, then the suggested
arguments string is what you want.

When you say that you want the arguments:

-a a_value -b "b_mod -b_op1 b_op1_value"


passed to your program.  Are you actually saying that this is what you
type on the command line of a unix shell?  

Right. This is what I would type if I'm running the program in a terminal. I should have plainly conveyed this piece of information to avoid all the confusions I created.
 
If so, then the double quotes
are _not_ part of the argv array sent to your program and Arguments #1
above is _not_ what you want.  All common unix shells interpret double
quotes specially and do not just pass them verbatim on to the program.

I was suspecting that the interpretations of double-quotes between condor and shells are different. Your explanation tells what is going on. I was wondering whom to blame, condor or shell. But now I know they are just different. :)
 

The above arguments in common unix shells such as bash or tcsh produce
the following arguments to the program:

Arguments #2

arg1: -a
arg2: a_value
arg3: -b
arg4: b_mod -b_op1 b_op1_value

Thanks for explaining how shells work. I did not know this. 
 
To produce those arguments with condor, you would put the following in
the submit file:

arguments = "-a a_value -b 'b_mod -b_op1 b_op1_value'"

Great! This works!
 
I suspect that we are talking past each other.  If you still have
problems, I just noticed for the first time that not only are you and I
in the same institution--we're in the same department!  How
embarrassing.  Drop by my office (Chamberlin 3215) any morning if you
need more help.  I'm the one who wrote the "new" argument parser in
condor.  The syntax was constrained in several ways and is therefore a
little quirky, but I am confident, at least in unix, that any argument
array can be represented, unless it contains characters forbidden by the
current implementation of the schedd's ClassAd log (e.g. newlines).  In
windows, things are a little more hazy, because programs construct their
own arguments array (if they construct one at all), and it is therefore
up to the program to decide how to interpret the arguments string.

Thanks for the help. I'm currently in Beijing though. Will certainly drop by with more questions after I get back. Enjoy the Madison Winter!


Cheers, Wei

--
Wei Wang
Department of Physics
University of Wisconsin - Madison
Office: 608-262-3395
Mobile: 917-250-0705(U.S.)
Mobile: 13718027905(China)