On 04/05/2020 03:33, Mike Kelsey wrote:
Well, I have been successful in this!  For my wrapper module, I implemented
a very simple custom EasyBlock ("scdms_release.py"), which provides an extra
EasyConfig parameter to specify the diretory, and overloads the base
function make_module_dep().

Besides the usual sanity checking, this function is really quite simple:

     def make_module_dep(self, unload_info=None):
         txt = ''
[...]
         txt += self.module_generator.prepend_paths('MODULEPATH',
             cdmsreleasedir, allow_abs=True)
         txt += super(EB_scdms_minus_release, self).make_module_dep()
         return txt

When I implemented this and built the module, I was able to load it in a
clean session without pointing to the "extra" module path.

The same wrapper module also loaded successfully into our HPRC OnDemand
Jupyter session.  Now I have to figure out why our Python packages aren't
being found, but that's an easier problem to solve.

Many thanks to Kenneth and to Ake for their help and suggestions!

Excellent!

Sounds like a pretty clean solution to me...

Just one minor suggestion here: rather than using self.module_generator.prepend_paths, I would use self.module_generator.use instead, to inject "module use" commands (or the equivalent) in the generated module file.

It may not matter much in practice nowadays though, but it used to with older versions of Lmod I think...


regards,

Kenneth

                                                -- Mike

Reply via email to