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

Re: [HTCondor-users] Question about the conditionals in configuration



Hi Christoph,

Thanks for your reply!

Unfortunately, strcmp() can not solve my problem. I tried it, the strcmp() returns an interger(>0,=0,<0), but the  condor conditional can only recognize interger 0 or 1. Then I tried to transform strcmp() result to 0 or 1, but failed, the conditional does not support a complex _expression_.

We're doing a conditional configuration on Startd side. We have two types of resources, defining them as "physical machine" and "virtual machine":

       resource_type = "virtual machine" or resource_type = "physical machine"

If the resource_type is "virtual machine", there will be some sepecial attributes added.

Following your hints, I found a function "ifThenElse" to solve this:

START = ifThenElse( resource_type == "virtual machine", ($(START) && TARGET.POOL=="virtual"), 
$(START))
RESERVED_MEMORY =
ifThenElse( resource_type == "virtual machine", 0, 3000
)
...

But ifThenElse is part of _expression_ which would be evaluated everytime when START attribute is used. 

If the grammar could be like the following would be better:

       if resource_type is "virtual machine"
            START = $(START) && TARGET.POOL=="virtual"
         RESERVED_MEMORY = 0
          ...
       else
           RESERVED_MEMORY = 6000
           ...

Looking forward some hints or solutions!

(Thank you very much, Christoph!) 

Cheers,
Xiaowei

jiangxw@xxxxxxxxxx
 
From: Beyer, Christoph
Date: 2020-05-07 15:10
To: htcondor-users
Subject: Re: [HTCondor-users] Question about the conditionals in configuration
Hi,

you can do string comparison, check the classadd language here:

https://htcondor.readthedocs.io/en/stable/misc-concepts/classad-mechanism.html?highlight=strcmp#classad-syntax

strcmp() is probably what you are looking for.

When it comes to slot definitions though you will need to restart condor to make it happen, hence if you want to reorganise your slots depending on the owner of the job it's not gonna be very straight forward (but that is just a wild guess of course)

Best
christoph


--
Christoph Beyer
DESY Hamburg
IT-Department

Notkestr. 85
Building 02b, Room 009
22607 Hamburg

phone:+49-(0)40-8998-2317
mail: christoph.beyer@xxxxxxx


Von: jiangxw@xxxxxxxxxx
An: "htcondor-users" <htcondor-users@xxxxxxxxxxx>
Gesendet: Donnerstag, 7. Mai 2020 08:56:22
Betreff: [HTCondor-users] Question about the conditionals in configuration

Dear all,

Does the conditional in configuration support string comparison?

As the htcondor manual, it seems only support bool or simple number. 

Can we do this conditional in HTCondor configuration?

group = "cms"
if group == "cms"
  num_slots = 4

Thanks in advance!
Cheers,
Xiaowei

jiangxw@xxxxxxxxxx

_______________________________________________
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/