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

Re: [HTCondor-users] Windows: Non-standard installation + config path



Great, thanks to both of you - all this looks like it will work!

@Todd: Thanks for also giving solution two! In this case, it may really
be too much black magic for what can also be achieved much simpler.
Nevertheless, this trick might come in handy some day.

Somehow, I find this kind of information (also the one used in solution
one) quite hard to find in the documentation (if it is present at all).
Do others have this problem as well?

Thanks again,
Jens


Am 19.02.16 um 19:46 schrieb Todd Tannenbaum:
> On 2/19/2016 11:27 AM, Jens Schmaler wrote:
>> My idea was to have an additional environment
>> variable on machines with non-standard config file location. If this
>> variable is set, I would like to use it to define the config file,
>> otherwise I would fall back to the default:
>>
>> CUSTOM_CONFIG = $ENV(CONDOR_CUSTOM_CONFIG)
>>
>> LOCAL_CONFIG_FILE = ifThenElse( $(CUSTOM_CONFIG) =!= Undefined,
>> $(CUSTOM_CONFIG), $(DEFAULT_CONFIG) )
>>
>>
>> Unfortunately, this does not work. The ifThenElse does not get
>> evaluated, so condor_config_val still shows me the literal "ifThenElse"
>> expression instead of the desired result. Can someone explain this? Is
>> it at all possible to use conditional clauses in config files or is this
>> restricted to class ads?
>>
> 
> The issue is the "ifthenelse()" function is a ClassAd function; it can only be used in ClassAd expressions.
> 
> Conditionals can exist in the config file, but the syntax is different because config files are not ClassAds; see section 3.3.1 of the HTCondor Manual for the config file syntax at URL http://is.gd/ffZbg1.  
> 
> === SOLUTION ONE
> 
> Here is what I'd suggest to achieve what you want:
> 
> Since any config file knob names XXX can be overridden via an environment variable that starts with "_condor_XXX", I'd suggest leaving LOCAL_CONFIG_FILE set to your default.  If a machine wants to override it via the environment, just redefine it via an environment variable like so (from bash)
>   
>   export _condor_LOCAL_CONFIG_FILE=/my/non-standard/path/file 
> 
> Most people should stop reading here :)  
> 
> == SOLUTION TWO
> 
> You are still reading??? 
> 
> Well, if you want a solution with the approach Jens was pursuing, there are a few things to know: 
>  1) The way you can use all the power of ClassAd expressions inside your condor configuration is via $INT() and $REAL(); these config macros use the ClassAd parser to evaluate their first argument.
>  2) $ENV(X) will return the string UNDEFINED if X is not defined. Personally I think this is a bug that should someday be fixed so the empty string is returned instead of UNDEFINED.
> 
> So you COULD solve the issue as follows:
> 
>   DEFAULT_CONFIG = $(LOCAL_DIR)/condor_config.local
>   CUSTOM_CONFIG = $ENV(CONDOR_CUSTOM_CONFIG)
>   HAVE_CUSTOM_CONFIG = size("$(CUSTOM_CONFIG)") && "$(CUSTOM_CONFIG)"!="UNDEFINED"
>   if $INT(HAVE_CUSTOM_CONFIG)
>      LOCAL_CONFIG_FILE = $(CUSTOM_CONFIG)
>   else
>      LOCAL_CONFIG_FILE = $(DEFAULT_CONFIG)
>   endif
> 
> Note in the above I am leveraging the "trick" that $INT() allows me to use ClassAd functions.
> Of course, the above is really pretty ugly syntax and rather black magic, which is why sane people would simply go with solution one.  But I wrote up solution two just as a learning exercise.
> 
> hope the above helps,
> Todd
> 
> _______________________________________________
> 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/
>