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

Re: [HTCondor-users] Implementing non-uniform random choice of RANK expression



The config language won't evaluate an expression and set a value to it, then use that value later.
As you discovered, it instead expands $(r) in place and then evaluates the final value, and since $(r)
expands to random(), you get a different random value each time.

Because you are using .7 and .9, you can do what you want here with a single $RANDOM_CHOICE() expression

RANK=$RANDOM_CHOICE(1,1,1,1,1,1,1,2,2,3)

-tj

-----Original Message-----
From: HTCondor-users [mailto:htcondor-users-bounces@xxxxxxxxxxx] On Behalf Of Vladimir Brik
Sent: Wednesday, April 5, 2017 1:13 PM
To: HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx>
Subject: [HTCondor-users] Implementing non-uniform random choice of RANK expression

Hello.

I'd like to configure worker nodes to randomly pick a non-uniform random 
RANK expression on start-up. For example, given 3 choices of RANK, I 
want, say, 70% of nodes pick the first one, 20% the second one, and 10% 
the third one, or, in pseudo-code:

r=random()
if r < .7:
     RANK=rank1
else if r < .9:
     RANK=rank2
else:
     RANK=rank2

I am not sure how to do this in Condor's configuration language. If I do 
something like the following, it seems that a new random number is used 
in each clause:

r=random()
RANK=ifthenelse($(r) < 0.7, $(rank1), ifthenelse($(r) < 0.9, $(rank2), ...

How can I tell condor to assign a random number to variable "r" and then 
reference its value instead of interpolating it? Or, maybe there is a 
better way to do what I am trying to do?


Thanks,

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

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