Hi TJ et. al.,
many thanks for all your help! I got it now to work as intended! :)
Sorry for the late reply (I had to find some time to go back into the
details) - to make amends I compiled the thread in a short guide [1].
Cheers and thanks,
Thomas
[1]
https://confluence.desy.de/display/~hartmath/HTCondor+job+transforms
Please let me know, if you find any errors or have suggestions.
On 2018-10-16 16:47, John M Knoeller wrote:
> DiskUsage is an integer value, not a string, so its use as the second
> argument of regexps() like this is an error.
>
> Â
>
> ÂÂÂ EVALMACRO tmp.MyReq = regexps("25",DiskUsage,"33")
>
> Â
>
> Also, unfortunately the return value of regexps() here is just the
> output â33â when there is a match. You can see this by using
> condor_status to test.
>
> Â
>
> ÂÂ condor_status -limit 1 -af âregexps(â25â, â250000â, â33â)
>
> ÂÂ 33
>
> Â
>
> ÂÂ condor_status -limit 1 -af âregexps(â25(.*)â, â250000â, â33\1â)
>
> ÂÂ 330000
>
> Â
>
> I had forgotten that reqxps works that way, so my original suggestion
> needed a different regexps expression. To do a substitution in place,
> you need to use capture groups to preserve text before and after. ÂSo
> this works
>
> Â
>
> Â EVALMACRO tmp.MyReq = regexps("(.*)25(.*)",unparse(DiskUsage),"\\133\\2")
>
> Â SET Requirements $(tmp.MyReq)
>
> Â
>
> Producing this output from condor_transform_ads -verbose
>
> Â
>
> EVALMACRO tmp.MyReq to regexps("(.*)25(.*)",unparse(DiskUsage),"\\133\\2")
>
> ÂÂÂÂÂÂÂÂÂ tmp.MyReq = 3300000
>
> SET Requirements to 3300000
>
> DiskUsage = 2500000
>
> Requirements = 3300000
>
> ResidentSetSize = 500
>
> Â
>
> By the way, I think it is a bug that you have to double up the \ for
> EVALMACRO, when testing the reqexps() Âexpression in condor_status. I
> only used a single \, but condor_transform_ads required \\ which means
> that is parsing those expressions using ânew classadsâ syntax, which is
> wrong.
>
> Â
>
> -tj
>
> Â
>
> *From:* HTCondor-users <htcondor-users-bounces@xxxxxxxxxxx> *On Behalf
> Of *Collin Mehring
> *Sent:* Monday, October 15, 2018 12:15 PM
> *To:* HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx>
> *Subject:* Re: [HTCondor-users] job transform: change requirement condition?
>
> Â
>
> Hi Thomas,
>
> Â
>
> You can include the rest of the original value using capture groups. For
> example:Âregexps("^25(\d+)",unparse(DiskUsage),"33\1")
>
> Â
>
> Also, it looks like you're overriding the entire Requirements expression
> in that last example instead of DiskUsage.
>
> Â
>
> Hope this helps,
>
> Collin
>
> Â
>
> On Mon, Oct 15, 2018 at 8:17 AM Thomas Hartmann <thomas.hartmann@xxxxxxx
> <mailto:thomas.hartmann@xxxxxxx>> wrote:
>
> Hi all,
>
> unfortunately, I have to bother you again about all the transforms...
>
> I am still trying to get my head around the regexp{s} - in the attached
> transform rule I am trying to re/set DiskUsage (as example)
> Â DiskUsage = 2500000
> to something else ~~> 3300000
> so I assume that
> Â EVALMACRO tmp.MyReq = regexps("25",unparse(DiskUsage),"33")
> would first take the value of 'DiskUsage' and replace '25' by '33' -
> however, if I run the rule on the classad [1] the 'whole value' 2500000
> get's replaced as 33.
> Is there a way to go just for
> Â '25'00000 --> '33'00000
> ?
>
> Cheers and thanks,
> Â Thomas
>
>
> [1]
> > condor_transform_ads -verbose -rules example.rule example.classad
> EVALMACRO tmp.MyReq to regexps("25",unparse(DiskUsage),"33")
> Â Â Â Â Â tmp.MyReq = 33
> SET Requirements to 33
> DiskUsage = 2500000
> Requirements = 33
> ResidentSetSize = 500
>
>
>
> [btw]
> one thing I noted, that condor_transform_ads -verbose exits without any
> message and exit code 0 if the input 'class ads' use something
> dynamic as
>  output = /OUT/PATH/mypayload_$(Cluster)_$(Process).out
> i.e., when trying a submission set directly - which in hindsight is
> comprehensible but irritated me for a minute ;)
>
> probably, condor_transform_ads could throw an error, if it encounters
> something unparsable in the context?
> _______________________________________________
> HTCondor-users mailing list
> To unsubscribe, send a message to htcondor-users-request@xxxxxxxxxxx
> <mailto: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/
>
>
> Â
>
> --
>
> *Collin Mehring *| PE-JoSE - Software Engineer
>
> Image removed by sender.
>
>
>
> _______________________________________________
> 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/
>
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature