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

[HTCondor-users] behaviour of if on 'false' /macro return



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


  if regexp("OpSysAndVer == \"SL6\"",unparse(Requirements))
    EVALMACRO tmp.MyRequirements = regexps("(.*)SL6(.*)",unparse(Requirements),"\\1CentOS7\\2")
    SET Requirements $(tmp.MyRequirements)
    SET +SingularityImage "/foo/sl6"
  else
    SET +SingularityImage "/foo/el7"
  endif


executable     = mypayload.sh
universe       = vanilla
input          = mypayload.data
requirements   = (OpSysAndVer == "SL6" && ( TARGET.Arch == "X86_64" ) )
DiskUsage = 250000
executable     = mypayload.sh
universe       = vanilla
input          = mypayload.data
requirements   = (OpSysAndVer == "CentOS7" && ( TARGET.Arch == "X86_64" ) )
DiskUsage = 250000
 EVALSET WhatIsRegexp regexp("OpSysAndVer == \"SL6\"",unparse(Requirements))

 EVALSET WhatIsRegexp regexp("OpSysAndVer == \"SL6\"",Requirements)

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature