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

Re: [HTCondor-users] job classad regexp issue



Hi Frederic,

At this point, I would start to look at providing a custom ClassAd function to do the transformation.  This can be added via pointing CLASSAD_USER_LIBS at a particular library.

An example custom function is here:

https://github.com/bbockelm/condor-ce/blob/master/src/classad_ce.cpp

This adds a function "userHome()" which maps a username to the user's home directory.

Recently, we added the ability to register custom python functions in client ClassAd code (in the python bindings).  Since you are the same conference as I am today, maybe we can discuss how that could be extended to adding python functions to the schedd?

Brian

On Oct 14, 2014, at 4:52 PM, SCHAER Frederic <frederic.schaer@xxxxxx> wrote:

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