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

Re: [HTCondor-users] variable expansion question



This is correct. 

 

You do need to be careful to create a valid _expression_.  With the example below

if ALLOW_USER is blank before you get to the first statement, the final result will be

 

   ALLOW_USER :   && (OWNER==âengr) && (Owner==âphysâ)

  START :  && (OWNER==âengr) && (Owner==âphysâ)

 

This wonât work because it starts with a &&.  You can fix this by supplying a default

 

   ALLOW_USER = $(ALLOW_USER:true) && (OWNER=="engr")

   ALLOW_USER = $(ALLOW_USER:true) && (OWNER=="phys")

   START = $(ALLOW_USER:true)

 

So the expanded result will be a valid _expression_ :

 

   ALLOW_USER :   true && (OWNER=="engr") && (OWNER == âphysâ)

 

you can avoid this problem and simplify things by using the StringListMember

 

   ALLOW_USER = $(ALLOW_USER),engr

   ALLOW_USER = $(ALLOW_USER),phys

   if defined ALLOW_USER

      START = StringListIMember(Owner,â$(ALLOW_USER)â)

   endif

 

-tj

 

From: HTCondor-users <htcondor-users-bounces@xxxxxxxxxxx> On Behalf Of Rita
Sent: Monday, April 25, 2022 11:33 AM
To: HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx>
Subject: [HTCondor-users] variable expansion question

 

I would like to set up a list of users who can run jobs on a particular machine. The list is dynamic and I can generate it on the fly.

 

I was thinking of doing something like this.

 

ALLOW_USER = $(ALLOW_USER) && OWNER=="engr")

ALLOW_USER = $(ALLOW_USER) && (OWNER=="phys")

 

START = $(ALLOW_USER).

 

Is this the correct way to do it?

 

--

--- Get your facts first, then you can distort them as you please.--