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

Re: [HTCondor-users] ClassAds with curly braces: child*



On 21/11/2014 21:49, Vladimir Brik wrote:
Hello.

What is the significance of curly braces in machine classads like childDisk and childAccountingGroup? Do they indicate a special data type? For example:
childDisk = { 8044907,8044907 }

Is it possible to write a constraint expression that matches when a specific user is in childRemoteOwner? I tried using stringListMember but that doesn't seem to work.

Curly braces delimit a list. Square brackets delimit a record (i.e. key/value pairs). It's the opposite way round to JSON :-)

From
http://research.cs.wisc.edu/htcondor/classad/classad.html
I found a link to this (ten-year-old) document which I believe is still authoritative:
http://research.cs.wisc.edu/htcondor/classad/refman.pdf

You can also play with this stuff in the Python API.

>>> import classad
>>> a = classad.ExprTree('{ 8044907,8044908 }')
>>> a
{ 8044907,8044908 }
>>> a.eval()
[8044907, 8044908]

>>> classad.ExprTree("max({ 8044907,8044908 })")
max({ 8044907,8044908 })
>>> classad.ExprTree("max({ 8044907,8044908 })").eval()
8044908L

To check if a specific user is in a list, the anycompare function is probably what you want.

>>> classad.ExprTree('anycompare("==", { 8044907,8044908 }, 8044907)').eval()
True
>>> classad.ExprTree('anycompare("==", { 8044907,8044908 }, 8044906)').eval()
False

HTH,

Brian.