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

[HTCondor-users] job classad regexp issue



Hi,

 

I have jobs entering htcondor through an ARC CE, which set this VO :

x509UserProxyVOName = "vo.irfu.cea.fr"

 

I’d like to use this variable in order to build accounting groups, and set this “VO name” as the primary group.

Unfortunately, the dots are the accounting subgroups separators, and therefore I have to regexp replace the dots in order to prevent the primary group from being “vo”

And since I must replace stuff, I’d like to make sure I’m not hit by other fancy chars in the VO name, so I’d like to escape the VO name with such a regexp :

 

s/[^a-zA-Z]/_/g

 

i.e : replace everything I don’t recognize with underscores.

 

I tried to do that with the regexps function, but I faced issues.

First issue was that if there is nothing to replace, the empty string is returned if you happen to use backreferences, which I did.

Second issue was that this function does not allow to replace every occurrence, and I’m not sure, but I think it did not support negative match (does it ?)

 

I tried to emulate this behavior with this :

tmp1 = ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName), regexps("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName,"\1_\2"), x509UserProxyVOName )

tmp2 = ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",$(tmp1)), regexps("([_a-z0-9]+)[\.](.+)",$(tmp1) ,"\1_\2"), $(tmp1) )

tmp3 = ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",$(tmp2)), regexps("([_a-z0-9]+)[\.](.+)",$(tmp2) ,"\1_\2"), $(tmp2) )

tmp4 = ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",$(tmp3)), regexps("([_a-z0-9]+)[\.](.+)",$(tmp3) ,"\1_\2"), $(tmp3) )

escVOName = ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",$(tmp4)), regexps("([_a-z0-9]+)[\.](.+)",$(tmp4) ,"\1_\2"), $(tmp4) )

 

 

The resulting escVOName seems to be what I want as long as there are less than 5 dots… but it’s not clean.

And worse, the resulting classad is absolultely horrible : this is just part of it :

 

AccountingGroup = strcat("group_",ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName),regexps("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName,"\1_\2"),x509UserProxyVOName)),regexps("([_a-z0-9]+)[\.](.+)",ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName),regexps("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName,"\1_\2"),x509UserProxyVOName),"\1_\2"),ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName),regexps("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName,"\1_\2"),x509UserProxyVOName))),regexps("([_a-z0-9]+)[\.](.+)",ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName),regexps("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName,"\1_\2"),x509UserProxyVOName)),regexps("([_a-z0-9]+)[\.](.+)",ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName),regexps("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName,"\1_\2"),x509UserProxyVOName),"\1_\2"),ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName),regexps("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName,"\1_\2"),x509UserProxyVOName)),"\1_\2"),ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName),regexps("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName,"\1_\2"),x509UserProxyVOName)),regexps("([_a-z0-9]+)[\.](.+)",ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName),regexps("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName,"\1_\2"),x509UserProxyVOName),"\1_\2"),ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName),regexps("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName,"\1_\2"),x509UserProxyVOName)))),regexps("([_a-z0-9]+)[\.](.+)",ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName),regexps("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName,"\1_\2"),x509UserProxyVOName)),regexps("([_a-z0-9]+)[\.](.+)",ifThenElse(regexp("([_a-z0-9]+)[\.](.+)",x509UserProxyVOName),regexps("([_a

 

I cut it here, but this is only *part*of this very dirty _expression_ wich is at least one big screen long…

Horrible, isn’t it ?

 

So my question is : does someone know of a clean way to proceed ?

 

Thanks