NodeUtils
Cluster nodes utility module
The NodeUtils module is a ClusterShell helper module that provides supplementary services to manage nodes in a cluster. It is primarily designed to enhance the NodeSet module providing some binding support to external node groups sources in separate namespaces (example of group sources are: files, jobs scheduler, custom scripts, etc.).
- class ClusterShell.NodeUtils.GroupSource(name, groups=None, allgroups=None)[source]
ClusterShell Group Source class.
A Group Source object defines resolv_map, resolv_list, resolv_all and optional resolv_reverse methods for node group resolution. It is constituting a group resolution namespace.
- __init__(name, groups=None, allgroups=None)[source]
Initialize GroupSource
- Parameters:
name -- group source name
groups -- group to nodes dict
allgroups -- optional "all groups" result (string)
- __weakref__
list of weak references to the object
- class ClusterShell.NodeUtils.UpcallGroupSource(name, map_upcall=None, all_upcall=None, list_upcall=None, reverse_upcall=None, cfgdir=None, cache_time=None, mapall_upcall=None)[source]
GroupSource class managing external calls for nodegroup support.
Upcall results are cached for a customizable amount of time. This is controlled by cache_time attribute. Default is 3600 seconds.
The optional 'mapall' upcall returns all group-to-nodes mappings in a single call and is then used to serve both 'map' and 'list' queries from the cache.
- class ClusterShell.NodeUtils.GroupResolver(default_source=None, illegal_chars=None)[source]
Base class GroupResolver that aims to provide node/group resolution from multiple GroupSources.
A GroupResolver object might be initialized with a default GroupSource object, that is later used when group resolution is requested with no source information. As of version 1.7, a set of illegal group characters may also be provided for sanity check (raising GroupResolverIllegalCharError when found).
- __init__(default_source=None, illegal_chars=None)[source]
Lazy initialization of a new GroupResolver object.
- __weakref__
list of weak references to the object
- property default_source_name
Get default source name of resolver.
- group_nodes(group, namespace=None)[source]
Find nodes for specified group name and optional namespace.
- has_node_groups(namespace=None)[source]
Return whether finding group list for a specified node is supported by the resolver (in optional namespace).