The equivalent in Lua would be:

modextravars = {
  'GAUSS_SCRDIR': '/scratch/Users/os.getenv("USER")'
}

This actually brings me to another question. The variable I am setting here
is needed by the program but the value is site specific. Is the best
mechanism to handle this type of thing in local easyconfig files? That make
contributing back a bit harder.

Thanks.



Glenn

On Mon, Feb 29, 2016 at 2:44 PM, Glenn Johnson <[email protected]>
wrote:

> Well, use of the local variable can be avoided, I just thought that might
> be a little cleaner. The following (TCL) will also work in the module file:
>
> setenv GAUSS_SCRDIR /scratch/Users/$env(USER)
>
> With that, something like the following could go in modextravars:
>
> modextravars = {
>   'GAUSS_SCRDIR': '/scratch/Users/\$env(USER)'
> }
>
> Would that work, at least for TCL?
>
> Thanks.
>
>
> Glenn
>
> On Mon, Feb 29, 2016 at 1:40 PM, Pablo Escobar Lopez <
> [email protected]> wrote:
>
>> I have this in some of my easyconfigs. It works for me with tcl modules,
>> I haven't tried with lua syntax. I think you could also use $HOME or $USER
>> or any other env var. It's not exactly what you ask of adding env vars
>> which are local to the module file but maybe it helps...
>>
>> modextravars = {
>> 'PYRO_LOOKUP_FILE': '\$EBROOTAMPLICONNOISE/Data/LookUp_E123.dat',
>> 'SEQ_LOOKUP_FILE': '\$EBROOTAMPLICONNOISE/Data/Tran.dat',
>> }
>>
>>
>>
>> 2016-02-29 20:25 GMT+01:00 Glenn Johnson <[email protected]>:
>>
>>> Hi Kenneth,
>>>
>>> Yes, that helps. The example I gave was TCL but I did plan on using Lua
>>> for EB generated modules. I think the only environment variable that we
>>> ever need to grab is $USER, as in my example. Is there another
>>> (better?) way to accomplish this?
>>>
>>> Thanks.
>>>
>>>
>>> Glenn
>>>
>>> On Mon, Feb 29, 2016 at 1:12 PM, Kenneth Hoste <[email protected]>
>>> wrote:
>>>
>>>> Hi Glenn,
>>>>
>>>> On 29/02/16 20:02, Glenn Johnson wrote:
>>>>
>>>> I am relatively new to Easybuild so I apologize if I overlooked
>>>> something. Is there a way to add extra variables that are local to
>>>> environment module files? That would be in addition to the 'root' variable
>>>> that is set. As an example, our (non-EB) Gaussian09 module uses the
>>>> following to set the user scratch directory:
>>>>
>>>> #%Module
>>>> ...
>>>> set user $env(USER)
>>>> ...
>>>> setenv GAUSS_SCRDIR /scratch/Users/$user
>>>>
>>>> I see the option to add extra environment variables:
>>>> modextravars
>>>>
>>>> How can I get the extra variables to use the value of a module local
>>>> variable?
>>>>
>>>>
>>>> The only way right now would be to use 'modtclfooter'.
>>>>
>>>> Since you get no control over the order, you'll probably need to jam
>>>> the 'setenv' in there too.
>>>>
>>>>     modtclfooter = "set user $env(USER)\nsetenv GAUSS_SCRDIR
>>>> /scratch/Users/$user"
>>>>
>>>> Note that if you ever start generating module files in Lua syntax (to
>>>> be consumed by Lmod), this will simply be ignored; to be 'safe' you should
>>>> add the equivalent 'modluafooter' too.
>>>>
>>>> I guess we could add support for something like "modlocalvars", but
>>>> since you also want to grab values from the environment, it would have to
>>>> be both 'modlocalvarstcl' and 'modlocalvarslua', and I don't like where
>>>> this is going... :)
>>>>
>>>> Does this help?
>>>>
>>>>
>>>> regards,
>>>>
>>>> Kenneth
>>>>
>>>
>>>
>>
>>
>> --
>> Pablo Escobar López
>> HPC systems engineer
>> sciCORE, University of Basel
>> SIB Swiss Institute of Bioinformatics
>> http://scicore.unibas.ch
>>
>
>

Reply via email to