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

Re: [HTCondor-users] ifThenElse woes



On 10/17/2023 9:28 AM, Rita wrote:
I have few(atleast 5) HOLD statements. They all work. However, I am trying to put them in a hold reason but for whatever reason only of the reasons show up.

Is there a better way to handle this? 

hold_reason = ifThenElse ( $(A), "held because of policy a",
                          ifThenElse ( $(B), "held because of policy b",
                          ifThenElse ( $(C), "held because of policy c","unknown")
                          )
                          )

This doesn't work. Was wondering if there is an easier or more intuitive way to manage this
                      

Hi Rita,

You don't say above if you are setting up a hold policy in your job submit file, or in your condor_config (to be applied to all jobs on the access point).    I will assume the latter.

Yes, there is an easier way assuming you are running HTCondor version 9.5 or above, which is to use SYSTEM_PERIODIC_HOLD_NAMES and friends.   See https://htcondor.readthedocs.io/en/latest/admin-manual/configuration-macros.html#SYSTEM_PERIODIC_HOLD_NAMES

This way, you can have separate hold reasons for each policy instead of globbing them all into one _expression_.  Plus it is easier to add/remove policies without impacting others.  Example from a condor_config file:

# Add a policy for memory
SYSTEM_PERIODIC_HOLD_NAMES = $(SYSTEM_PERIODIC_HOLD_NAMES) Mem
SYSTEM_PERIODIC_HOLD_Mem = MemoryUsage > XXXX
SYSTEM_PERIODIC_HOLD_Mem_REASON = "Memory usage exceeded XXXX"

# Add a policy for disk
SYSTEM_PERIODIC_HOLD_NAMES = $(SYSTEM_PERIODIC_HOLD_NAMES) Disk
SYSTEM_PERIODIC_HOLD_Disk = DiskUsage > YYYY
SYSTEM_PERIODIC_HOLD_Disk_REASON = "Disk usage exceeded YYYY"

Hope the above helps,
Todd