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

Re: [HTCondor-users] variable expansion question



The second form is better if you have more than a single user that you want to allow.

 

-tj

 

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

 

Which is preferred? 

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

or 

 

ALLOW_USER = $(ALLOW_USER),engr

ALLOW_USER = $(ALLOW_USER),phys

   if defined ALLOW_USER

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

   endif

 

On Mon, Apr 25, 2022 at 3:02 PM John M Knoeller <johnkn@xxxxxxxxxxx> wrote:

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.--

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


 

--

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