btw: are/is the transforms/syntax actually a stack?? (in one or the
other direction?)
I just noticed, that the order of steps seems to be 'inverse' to what I
have naively assumed, i.e., the rules top-down [1].
mytmp.baz gets true when evaluating the requirements string - that got
modified 'before' etc. ð
Cheers,
Thomas
[1]
> condor_transform_ads -verbose -rule /tmp/my.rule.order
/tmp/my.classads.sl6
EVALMACRO tmp.MyRequirements to
regexps("(.*)SL6(.*)",unparse(Requirements),"\\1CentOS7\\2")
tmp.MyRequirements = ( OpSysAndVer == "CentOS7" && (
TARGET.Arch == "X86_64" ) )
SET Requirements to ( OpSysAndVer == "CentOS7" && ( TARGET.Arch ==
"X86_64" ) )
SET +SingularityImage to "/foo/sl6"
EVALSET mytmpfoo to regexp("OpSysAndVer == \"SL6\"",unparse(Requirements))
SET mytmpfoo to false
EVALSET mytmpbaz to regexp("OpSysAndVer ==
\"CentOS7\"",unparse(Requirements))
SET mytmpbaz to true
+SingularityImage = "/foo/sl6"
DiskUsage = 250000
executable = mypayload.sh
input = mypayload.data
mytmpbaz = true
mytmpfoo = false
requirements = ( OpSysAndVer == "CentOS7" && ( TARGET.Arch == "X86_64" ) )
universe = vanilla
On 2018-11-02 12:40, Thomas Hartmann wrote:
> Hi all,
>
> a short question how if/else in the old-style syntax handles false
> returns from macros:
>
> ~~> I have a set of class ads 'my.classads.{sl6,el7}' (see attachement)
> which I want to transform with 'my.rule'
>
> my.rule has an if/else on the return of a regexp(), that is supposed to
> return true when finding 'SL6' and false else. Applying my.rule to the
> ClassAds with the stringified requirements containing 'SL6' works fine [1].
> But if I apply the same rule to a string where regexp does not match,
> the whole transform just fails [2] - where I would have expected that
> the rule would just take the else branch.
>
> To test if regexp() does not return ERROR on a non-string argument or
> so, in a cross-check 'my.rule.set' just sets the result of regexp() as
> ClassAd [3].
> For
> my.classads.{sl6,el7}
> the return values are a boolean
> WhatIsRegexp = {true,false}
> as far as I can see ~~> and my.rule should take the else-branch on
> false, or?
>
> If the target is not a string but an ad, EVALSET regexp() ends up as
> undefined [4], which I suppose is the way for EVAL* to interpolate ERROR.
>
> Long story short: why does the transform fail on 'if false'? ;)
>
> Cheers and thanks for any hints,
> Thomas
>
>
>
> [1]
>> condor_transform_ads -verbose -rule /tmp/my.rule /tmp/my.classads.sl6
> EVALMACRO tmp.MyRequirements to
> regexps("(.*)SL6(.*)",unparse(Requirements),"\\1CentOS7\\2")
> tmp.MyRequirements = ( OpSysAndVer == "CentOS7" && (
> TARGET.Arch == "X86_64" ) )
> SET Requirements to ( OpSysAndVer == "CentOS7" && ( TARGET.Arch ==
> "X86_64" ) )
> SET +SingularityImage to "/foo/sl6"
> +SingularityImage = "/foo/sl6"
> DiskUsage = 250000
> executable = mypayload.sh
> input = mypayload.data
> requirements = ( OpSysAndVer == "CentOS7" && ( TARGET.Arch == "X86_64" ) )
> universe = vanilla
>
> [2]
>> condor_transform_ads -verbose -rule /tmp/my.rule /tmp/my.classads.el7
> Transform of ad failed!
>
> [3]
>> condor_transform_ads -verbose -rule /tmp/my.rule.set
> /tmp/my.classads.{sl6,el7}
>
> [4]
>> condor_transform_ads -verbose -rule
> /tmp/my.rule.set.nonstringasregexptarget /tmp/my.classads.el7
> ...
> WhatIsRegexp = undefined
>
>
>
>
> _______________________________________________
> 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/
>
tmp.baz = regexp("OpSysAndVer == \"CentOS7\"",unparse(Requirements))
tmp.foo = regexp("OpSysAndVer == \"SL6\"",unparse(Requirements))
if $(tmp.foo)
EVALMACRO tmp.MyRequirements = regexps("(.*)SL6(.*)",unparse(Requirements),"\\1CentOS7\\2")
SET Requirements $(tmp.MyRequirements)
SET +SingularityImage "/foo/sl6"
else
SET +SingularityImage "/foo/el7"
endif
EVALSET mytmpfoo $(tmp.foo)
EVALSET mytmpbaz $(tmp.baz)
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature