Hi Trey,

On 03/09/14 08:03, Trey Dockendorf wrote:
Thanks ! setting the following worked:

MYEBDIR=$HOME/easybuild/my_easyblocks
EB_MNS_DIR=$HOME/easybuild/easybuild_overrides
PYTHONPATH=/usr/lib/python2.6/site-packages/:$EB_MNS_DIR:$MYEBDIR

Since easybuild is installed by root , $PYTHONPATH was never set (as far as I 
could tell).

Yes, there's no real need to, except when you're extending the easybuild namespaces further in other directories like you're doing, then the easybuild-framework ones need to be considered first by Python to make things work.

Technically, including an extend_path statement in the __init__.py files should be sufficient too, but that currently doesn't work for easyblocks because we flatten the namespace there (see also https://github.com/hpcugent/easybuild/wiki/Setting-up-your-own-easyblocks-repository#flattening-the-easyblocks-namespace-in-easybuild).


regards,

Kenneth

- Trey

=============================

Trey Dockendorf
Systems Analyst I
Texas A&M University
Academy for Advanced Telecommunications and Learning Technologies
Phone: (979)458-2396
Email: [email protected]
Jabber: [email protected]

----- Original Message -----
From: "Kenneth Hoste" <[email protected]>
To: [email protected]
Sent: Tuesday, September 2, 2014 2:27:21 AM
Subject: Re: [easybuild] Getting started with EB - integrating into existing 
Lmod environment

Hi Trey,

On 02/09/14 01:24, Trey Dockendorf wrote:
Yes, you can use a custom module naming scheme, which would
probably
derive from the existing HierarchicalMNS.

Documentation for that is available at
https://github.com/hpcugent/easybuild/wiki/Using-a-custom-module-naming-scheme,
but (still) needs to be updated w.r.t. the extended support for
hierarchical schemes.

Initial attempts failing.

$ ls -R /home/treydock/easybuild/easybuild_overrides/
/home/treydock/easybuild/easybuild_overrides/:
easybuild

/home/treydock/easybuild/easybuild_overrides/easybuild:
__init__.py  __init__.pyc  tools

/home/treydock/easybuild/easybuild_overrides/easybuild/tools:
__init__.py  __init__.pyc  module_naming_scheme

/home/treydock/easybuild/easybuild_overrides/easybuild/tools/module_naming_scheme:
__init__.py  __init__.pyc  local_module_naming_scheme.py
  local_module_naming_scheme.pyc

$ cat
/home/treydock/easybuild/easybuild_overrides/easybuild/tools/module_naming_scheme/local_module_naming_scheme.py
import os
from easybuild.tools.module_naming_scheme import HierarchicalMNS

class LocalModuleNamingScheme(HierarchicalMNS):
    """Class implementing local module naming scheme."""

    def det_short_module_name(self, ec):
        """
        Determine short module name, i.e. the name under which
        modules will be exposed to users.
        Examples: GCC/4.8.3, OpenMPI/1.6.5, OpenBLAS/0.2.9, HPL/2.1,
        Python/2.7.5
        """
        return os.path.join(ec['name'].lower(), ec['version'] +
        ec['versionsuffix'])

$ MYEBDIR=$HOME/easybuild/my_easyblocks
$ EB_MNS_DIR=$HOME/easybuild/easybuild_overrides
$ export PYTHONPATH=$PYTHONPATH:$MYEBDIR:$EB_MNS_DIR
$ echo $PYTHONPATH
:/home/treydock/easybuild/my_easyblocks:/home/treydock/easybuild/easybuild_overrides
You need to make sure the framework is in your Python search patch
too,
and it should be in there first (before your easybuild_overrides
dir).

Also, make sure *all* the __init__.py files contain the extend_path
line
(maybe that by itself it enough to fix your problem).

$ eb --avail-module-naming-schemes
Traceback (most recent call last):
    File "/usr/lib/python2.6/site-packages/easybuild/main.py", line
    52, in <module>
      import easybuild.tools.options as eboptions
    File
    "/usr/lib/python2.6/site-packages/easybuild/tools/options.py",
    line 41, in <module>
      from easybuild.framework.easyblock import EasyBlock
    File
    "/usr/lib/python2.6/site-packages/easybuild/framework/easyblock.py",
    line 52, in <module>
      from easybuild.framework.easyconfig.easyconfig import
      (EasyConfig, ActiveMNS, ITERATE_OPTIONS,
    File
    
"/usr/lib/python2.6/site-packages/easybuild/framework/easyconfig/__init__.py",
    line 35, in <module>
      from easybuild.framework.easyconfig.easyconfig import
      EasyConfig
    File
    
"/usr/lib/python2.6/site-packages/easybuild/framework/easyconfig/easyconfig.py",
    line 50, in <module>
      from easybuild.tools.module_naming_scheme import
      DEVEL_MODULE_SUFFIX
ImportError: cannot import name DEVEL_MODULE_SUFFIX
I think this signals that the __init__.pyt in
easybuild_overrides/easybuild/tools/module_naming_scheme doesn't
contain
an extend_path?
Either that, or the path /usr/lib/python2.6/site-packages/ isn't
first
in your Python search path.

It should be though, since the DEVEL_MODULE_SUFFIX is provided by the
__init__.py in
/usr/lib/python2.6/site-packages/easybuild/tools/module_naming_scheme.


regards,

Kenneth
EasyBuild takes into account that certain modules may have been
loaded,
and should stay loaded.

I haven't used this in combination with sticky modules myself
(maybe
others have).
If you notice any issues related to this, let us know, since that
would
be a bug.

I'll give it a try and see how it works, thanks.

- Trey

Reply via email to