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

Re: [HTCondor-users] condor_submit with -append arguments



Hello,

Sorry, I just realized I should have used the mailing list. Thank you very much for your help. I am really glad the arguments can be passed this way. But I do have one more question please. In the previous question I simplified the problem a bit, in order to illustrate what I wanted. What I really need is to pass the two arguments (radius, length) while still using the $(Process) as argument variable. So my script now looks like:

$ cat > submit_job.sh
#!/bin/sh
if [ $# -lt 1 ]
    then
    echo "Usage: ./submit_job.sh <radius> <length>"
    echo "E.g, ./submit_job.sh 60 80"
    exit
fi
radius=$1
length=$2
condor_submit -append "args = ${Process} ${radius} ${length}"  an.job


to be executed as something like ./submit_job.sh 32 40. But now $(Process) or ${Process} is not used. Would it be possible to use the two input parameters together with the corresponding job process number?

Thank you,

Adriana

________________________________________
From: David Champion [dgc@xxxxxxxxxxxx]
Sent: Friday, November 21, 2014 6:06 AM
To: HTCondor-Users Mail List
Cc: Adriana Bungau
Subject: Re: condor_submit with -append arguments

Hi Adriana -

* On 20 Nov 2014, Adriana Bungau wrote:
> Second file I want to execute using some input parameters:
>
> $ cat > submit_job.sh
> if [ $# -lt 1 ]
>     then
>     echo "Usage: ./submit_job.sh <radius> <length>"
>     echo "E.g, ./submit_job.sh 60 80"
>     exit
> fi
> radius=$1
> length=$2
> condor_submit -append 'args = $(radius) $(length)'  an.job

Your arguments are getting into the script OK, but they're not being
delivered to condor_submit.  There are two reasons for that:

* You need {curly braces}, not (parentheses), for variable expansions.
$(x) substitutes the output from the command "x" instead.

* You need "double quotes", not 'single quotes', to permit variable
expansion. Single quotes will copy the quoted material literally,
without allowing variables to expand.  (Sometimes that's what you want.)

I would also advise always beginning a shell script with #!/bin/sh or
#!/bin/bash.  This is not always necessary, but it is always safe and
it protects you from some strange edge cases.

So a modified script might be:

$ cat > submit_job.sh
#!/bin/sh
if [ $# -lt 1 ]
    then
    echo "Usage: ./submit_job.sh <radius> <length>"
    echo "E.g, ./submit_job.sh 60 80"
    exit
fi
radius=$1
length=$2
condor_submit -append "args = ${radius} ${length}"  an.job

--
       David Champion • dgc@xxxxxxxxxxxx • University of Chicago
Enrico Fermi Institute • Computation Institute • USATLAS Midwest Tier 2
                      OSG Connect • CI Connect
University of Huddersfield inspiring tomorrow's professionals.
[http://marketing.hud.ac.uk/_HOSTED/EmailSig2014/EmailSigFooter.jpg]

This transmission is confidential and may be legally privileged. If you receive it in error, please notify us immediately by e-mail and remove it from your system. If the content of this e-mail does not relate to the business of the University of Huddersfield, then we do not endorse it and will accept no liability.