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

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