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

Re: [Condor-users] Looping in Condor job description scripts?



Hi Wei,

There are some subtleties with $$(). It is only evaluated after the job is matched to a machine. That's too late for choosing the log file, but not too late for other things, such as the arguments (which is what I assumed you were trying to set).

$$() is evaluated after matching and $() is evaluated at submit time. We are only using $$() in this case because it happens to support evaluation of arbitrary expressions via $$([expr]) syntax. We don't need access to attributes of the machine in this expression, so it is too bad that something like $([expr]) isn't supported. That would do the trick nicely.

--Dan

Wei Wang wrote:
Hi,

Thanks to everyone's help. I actually just got a chance to try the fancy way, $$([ClassAd Expr]), suggested by Alan and Dan. However, I got no luck. The whole thing, i.e. $$([*]), is treated literally but not get evaluated. Is there anything that I'm missing?

Here is the script I use:

log = $$([$(Process)+100]).log

But I get a log file called like:

$$([7+100]).log

Well, 7 is correctly replaced but not the expression. Same story for Dan's suggestion using the String approach. What did I do wrongly? Thanks!


--- Wei

On Fri, Apr 24, 2009 at 11:18 AM, Dan Bradley <dan@xxxxxxxxxxxx <mailto:dan@xxxxxxxxxxxx>> wrote:

    Hi Wei,

    Yes, Condor 7.2.2 is recent enough to use the $$([ ... ]) ClassAd
    expression syntax in the way that was suggested.

    Here's one way to get 6-digit numbers of equal length with leading
    zeros:

    Arguments =
    "$$([substr(strcat(string(0),string(0),string(0),string(0),string(0),string(0),string($(Process))),-6)])"

    This produces the sequence

    000000
    000001
    000002
    ...

    To my surprise, the following somewhat simpler expression did not
    work:

    Arguments = "$$([substr(strcat(""000000"",string($(Process))),-6)])"

    It seems that double quotes are not correctly handled inside of
    $$([ ...
    ]) expressions.

    --Dan

    Wei Wang wrote:
    > Hi Alan and David,
    >
    > Thanks for the suggestions. David's suggestion works for our Condor
    > cluster. However, how "recent" is recent enough for Alan's scripts?
    > Our Condor is version 7.2.2. Could there be another way (more
    general)
    > of forming these number strings that have equal length?
    >
    > Thanks!
    >
    > --- Wei
    >
    > On Thu, Apr 9, 2009 at 5:24 AM, Alan Woodland
    <alan.woodland@xxxxxxxxx <mailto:alan.woodland@xxxxxxxxx>
    > <mailto:alan.woodland@xxxxxxxxx
    <mailto:alan.woodland@xxxxxxxxx>>> wrote:
    >
    >     2009/4/9 David Brodbeck <brodbd@xxxxxxxxxxxxxxxx
    <mailto:brodbd@xxxxxxxxxxxxxxxx>
    >     <mailto:brodbd@xxxxxxxxxxxxxxxx
    <mailto:brodbd@xxxxxxxxxxxxxxxx>>>:
    >     >
    >     > On Apr 8, 2009, at 4:23 PM, Wei Wang wrote:
    >     >
    >     >> Hi, dear Condor-users,
    >     >>
    >     >> Is it possible to do looping inside a Condor job
    description file?
    >     >> Here is logic of describing what I want to do:
    >     >>
    >     >> ......
    >     >> Arguments = $(parameter)
    >     >> ......
    >     >> DO i = 1, N
    >     >> parameter = i
    >     >> queue
    >     >> ENDDO
    >     >>
    >     >> So I can submit N jobs without the trouble of using
    Shell/Perl/
    >     >> Python to generate N different files then use condor_submit N
    >     times.
    >     >>
    >     >> Thanks!
    >     >
    >     > How about:
    >     >
    >     > ....
    >     > Arguments = $(Process)
    >     > ....
    >     > Queue N
    >     >
    >     > $(Process) starts at 0 and increments as each job is queued.
    >     >
    >     Or with recent versions this trick works:
    >
    >     Arguments = $$([$(Process) + 100])
    >
    >     Would cause the arguments to start at 100 instead of 0.
    >
    >     Alan


------------------------------------------------------------------------

_______________________________________________
Condor-users mailing list
To unsubscribe, send a message to condor-users-request@xxxxxxxxxxx with a
subject: Unsubscribe
You can also unsubscribe by visiting
https://lists.cs.wisc.edu/mailman/listinfo/condor-users

The archives can be found at: https://lists.cs.wisc.edu/archive/condor-users/