mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-01 15:37:32 +08:00
LMOD Dependency resolver - Default mapping file
If a lmod_modules_mapping.yml file exists in the config folder then it will be taken into consideration automatically to map Galaxy requirements to LMOD modules.
This commit is contained in:
@@ -20,12 +20,13 @@
|
||||
* lmodexec - Path to the lmod executable on your system - Default: value of the "LMOD_CMD" environment variable
|
||||
* settargexec - Path to the settarg executable on your system - Default: value of the "LMOD_SETTARG_CMD" environment variable
|
||||
* modulepath - Path to the folder that contains the LMOD module files on your system - Default: value of the "MODULEPATH" environment variable
|
||||
* versionless - Set it to true to resolve the dependency based on its name only (the version number is ignored) - Default: false
|
||||
* mapping_files - Path to a Yaml configuration file that can be used to link tools requirements with existing LMOD modules - Default: None
|
||||
* versionless - Set it to true to resolve a dependency based on its name only (the version number is ignored) - Default: false
|
||||
* mapping_files - Path to a Yaml configuration file that can be used to link tools requirements with existing LMOD modules - Default: config/lmod_modules_mapping.yml
|
||||
Important notes:
|
||||
- All the above attributes are optional
|
||||
- The value of the lmodexec attribute can't just be "module" because module is actually a bash function and not the real LMOD binary (see the result of the "type module" command)
|
||||
- The value of the modulepath attribute can also be a semicolon separated list of path
|
||||
- If the config folder of your Galaxy instance contains a file called "lmod_modules_mapping.yml" (based on the lmod_modules_mapping.yml.sample file) it will be taken into consideration automatically
|
||||
-->
|
||||
<!--
|
||||
<lmod />
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# This is an example mapping file for the LMOD Dependency resolver (in YAML format)
|
||||
#
|
||||
# The goal of this file is to map tool's requirements to existing LMOD modules available on your system
|
||||
# Of course, if the name of a requirement and the name of a module match perfectly, there is no need to map them together through this mapping file.
|
||||
#
|
||||
# This is a sample file so the first thing to do to activate the mapping system is to create a copy of this file called "lmod_modules_mapping.yml".
|
||||
# The Lmod dependency resolver is programmed to search and use this YAML file automatically if it exists in the "config" folder of your Galaxy instance.
|
||||
# Alternatively, you can also use the "mapping_files" attribute of the <lmod /> resolver in the dependency_resolvers_conf.xml file to specify a custom mapping file
|
||||
#
|
||||
# Example 1:
|
||||
#
|
||||
# Let's say that one of the wrapper installed on your Galaxy instance has the following requirement:
|
||||
#
|
||||
# <requirements>
|
||||
# <requirement type="package" version="1.5.0">PIPITS</requirement>
|
||||
# </requirements>
|
||||
#
|
||||
# But unfortunately, the name of the corresponding module file on your system is "pipits_pipeline/1.5.0"
|
||||
#
|
||||
# Then, to make Galaxy load/unload the appropriate module, you just have to add the following lines (without to the #) to the "lmod_modules_mapping.yml" file:
|
||||
#
|
||||
#- from:
|
||||
# name: PIPITS
|
||||
# version: 1.5.0
|
||||
# to:
|
||||
# name: pipits_pipeline
|
||||
# version: 1.5.0.6
|
||||
#
|
||||
#
|
||||
# Example 2:
|
||||
#
|
||||
# The requirements section specify a requirement on the PIPITS tool but do not ask for a specific version of it:
|
||||
#
|
||||
# <requirements>
|
||||
# <requirement type="package">PIPITS</requirement>
|
||||
# </requirements>
|
||||
#
|
||||
# Although, there is no version required you may want to force the loading of a version that is known to run well on your system.
|
||||
#
|
||||
# In that case you can add the following lines to the "lmod_modules_mapping.yml" file:
|
||||
#
|
||||
#- from:
|
||||
# name: PIPITS
|
||||
# unversioned: true
|
||||
# to:
|
||||
# name: pipits_pipeline
|
||||
# version: 1.4.0
|
||||
@@ -25,6 +25,7 @@ log = logging.getLogger(__name__)
|
||||
DEFAULT_LMOD_PATH = getenv('LMOD_CMD')
|
||||
DEFAULT_SETTARG_PATH = getenv('LMOD_SETTARG_CMD')
|
||||
DEFAULT_MODULEPATH = getenv('MODULEPATH')
|
||||
DEFAULT_MAPPING_FILE = 'config/lmod_modules_mapping.yml'
|
||||
INVALID_LMOD_PATH_MSG = "The following LMOD executable could not be found: %s. Either your LMOD Dependency Resolver is misconfigured or LMOD is improperly installed on your system !"
|
||||
EMPTY_MODULEPATH_MSG = "No valid LMOD MODULEPATH defined ! Either your LMOD Dependency Resolver is misconfigured or LMOD is improperly installed on your system !"
|
||||
|
||||
@@ -35,13 +36,22 @@ class LmodDependencyResolver(DependencyResolver, MappableDependencyResolver):
|
||||
resolver_type = "lmod"
|
||||
|
||||
def __init__(self, dependency_manager, **kwds):
|
||||
# Mapping file management
|
||||
self._set_default_mapping_file(kwds)
|
||||
self._setup_mapping(dependency_manager, **kwds)
|
||||
|
||||
# Other attributes
|
||||
self.versionless = _string_as_bool(kwds.get('versionless', 'false'))
|
||||
self.lmodexec = kwds.get('lmodexec', DEFAULT_LMOD_PATH)
|
||||
self.settargexec = kwds.get('settargexec', DEFAULT_SETTARG_PATH)
|
||||
self.modulepath = kwds.get('modulepath', DEFAULT_MODULEPATH)
|
||||
self.module_checker = AvailModuleChecker(self, self.modulepath)
|
||||
|
||||
def _set_default_mapping_file(self, resolver_attributes):
|
||||
if not resolver_attributes.has_key('mapping_files'):
|
||||
if exists(DEFAULT_MAPPING_FILE):
|
||||
resolver_attributes['mapping_files'] = DEFAULT_MAPPING_FILE
|
||||
|
||||
def resolve(self, requirement, **kwds):
|
||||
requirement = self._expand_mappings(requirement)
|
||||
name, version, type = requirement.name, requirement.version, requirement.type
|
||||
|
||||
Reference in New Issue
Block a user