lmod.spider module¶
-
class
lmod.spider.
Spider
(tree=None)[source]¶ Bases:
object
This is the class declaration of Spider class which emulates the spider tool provided by Lmod. The spider command is typically used to build the spider cache in your site. We use the spider tool to fetch all module files.
Public Methods:
get_trees: returns all module trees used with spider command get_names: returns all top-level keys from spider which is the software name get_modules: returns all full canonical module name. get_parents: return all parent modules, parent modules are modules that set MODULEPATH to another tree. get_all_versions: returns all versions of a specified module.
-
get_all_versions
(key)[source]¶ Get all versions of a particular software name. This is can be retrieved by reading
Version
key in spider output.Parameters:
Parameters: key (str, required) – name of software Returns: list of module name as versions Return type: list
-
get_modules
(name=[])[source]¶ Retrieve all full-canonical module names. This can be retrieved by fetching
fullName
key in the json output. The full-canonical module name represents the actual module name. One can filter output by passing a list of software names, if no argument is specified we will return all modules. We ignore spider records that contain.version
or.modulerc
whih are not actual modules.Parameters:
Parameters: name (type, required) – a list of software name to filter output Returns: returns a sorted list of all full canonical module name from all spider records. Return type: dict
-
get_names
(name=[])[source]¶ Returns a list of software names which are found by returning the top-level key from json structure. One can specify a list of module names to filter output.
Parameters:
Parameters: name (list, optional) – a list of software name to filter output Returns: return sorted list of all spider keys. Return type: list
-
get_parents
()[source]¶ Return all parent modules from all spider trees. This will search all
parentAA
keys in spider content. The parent modules are used for setting MODULEPATH to other trees. The parentAA is a nested list containing one or more parent module combination required to load a particular module. The spider output can contain several occurrences of parent modules in parentAA key so use aset
to add unique parent modules.Returns: sorted list of all parent modules. Return type: list
-