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

Re: [HTCondor-users] help on classAd regexp



Thank ToddM (and co-worker). Indeed the pcre documentation
https://www.pcre.org/current/doc/html/pcre2pattern.html#SEC19
is more clear on this than what I was reaging
https://www.geeksforgeeks.org/perl/perl-regex-cheat-sheet/

About using a python script, yes, in the shell I can combine condor_q and scripts
to do anything. But can I use such tricks in a JobRouter table ?
I thought that  I can only write a constrain _expression_ based on classAds

OTOH, Claude gave me this Example in HTCondor ClassAd context:

 regexp("^([^:]*:){3}[^:]*$", SomeAttribute)  # Exactly 3 colons in the string

It will take me eons to understand it, but does the work !
Here  I look for exactly two instances of (T1)

true
[crabtw@vocms069 ~]$ condor_q 1641600.0 -af 'regexp("^([^(T1)]*(T1)){2}[^(T1)]*$", "T1_a")'
false
[crabtw@vocms069 ~]$ condor_q 1641600.0 -af 'regexp("^([^(T1)]*(T1)){2}[^(T1)]*$", "T1_a,T1_b")'
true
[crabtw@vocms069 ~]$ condor_q 1641600.0 -af 'regexp("^([^(T1)]*(T1)){2}[^(T1)]*$", "T1_a,T1_b,T1_c")'
false
[crabtw@vocms069 ~]$ 

I am amazed.

Stefano