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

Re: [HTCondor-users] job transform: change requirement condition?

I think you're right that it's a type issue - regexps returns a String type, which would just be a constant once evaluated. So maybe just add an eval() around the regexps?

Michael V. Pelletier
Information Technology
Digital Transformation & Innovation
Integrated Defense Systems
Raytheon Company

-----Original Message-----
From: HTCondor-users [mailto:htcondor-users-bounces@xxxxxxxxxxx] On Behalf Of Thomas Hartmann
Sent: Wednesday, October 10, 2018 12:23 PM
To: htcondor-users@xxxxxxxxxxx
Subject: [External] Re: [HTCondor-users] job transform: change requirement condition?

Hi Michael,

thanks for the tip with regexps. Unfortunately, the way I have added it to my job transform seems to have no effect so far.
The job transform should in principle format the Requirement string [1] but still the resulting job's ad is the old one [2]

>From the documentation on regexps I would assume that it should work - but I am not sure, if 'Requirements' is a 'string target' (should be as a class ad, or?). Scanning through target also should match and replace substrings, or?

Cheers and thanks,

JOB_TRANSFORM_NAMES = $(JOB_TRANSFORM_NAMES), FOOFORM JOB_TRANSFORM_FOOFORM @=end [ copy_Requirements = BaseRequirements set_Requirements = regexps("OpSysAndVer\s*=\?*=\s*\"SL6\"",
BaseRequirements, "OpSysAndVer == \"CentOS7\"") ] @end

> condor_history -l JOB.ID
>> Requirements = ( OpSysAndVer == "SL6" ) && ( TARGET.Arch == "X86_64"
) && ...


String regexps
    (String pattern, String target, String substitute [ , String options
]) Uses the description of a regular expression given by string pattern to scan through the string target. When target is a regular expression as described by pattern, the string substitute is returned, with backslash expansion performed. If any argument is not a string, returns ERROR.

On 2018-10-10 15:08, Michael Pelletier wrote:
> Seems like you're looking for "regexps()" - to substitute something in the requirements string.
> So you'd match the job with your requirements expression where it's demanding SL6, and then your job transform would do something like this:
> Copy_requirements = RequiresScientificLinux6 Requirements = 
> regexps("OpSysAndVer\s*=\?*=\s*\"SL6\"", RequiresScientificLinux6, 
> "OpSysAndVer == \"CentOS6\"")
> That ought to do the trick, I think.
> Michael V. Pelletier
> Information Technology
> Digital Transformation & Innovation
> Integrated Defense Systems
> Raytheon Company
> _______________________________________________
> 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/