Package ClusterShell :: Module NodeSet
[hide private]
[frames] | no frames]

Module NodeSet

source code


Cluster node set.

A module to deal efficiently with pdsh-like rangesets and nodesets.
Instances of RangeSet and NodeSet both provide similar operations than
the builtin set() type and Set object.
   [ See http://www.python.org/doc/lib/set-objects.html ]

Usage example:

    # Import NodeSet class
    from ClusterShell.NodeSet import NodeSet

    # Create a new nodeset from pdsh-like pattern
    nodeset = NodeSet("cluster[1-30]")

    # Add cluster32 to nodeset
    nodeset.update("cluster32")

    # Remove from nodeset
    nodeset.difference_update("cluster[2-5]")

    # Print nodeset as a pdsh-like pattern
    print nodeset

    # Iterate over node names in nodeset
    for node in nodeset:
        print node

Classes [hide private]
  RangeSetException
used by RangeSet
  RangeSetParseError
used by RangeSet when a parse cannot be done
  RangeSetPaddingError
used by RangeSet when a fatal padding incoherency occurs
  NodeSetException
used by NodeSet
  NodeSetParseError
used by NodeSet when a parse cannot be done
  NodeSetParseRangeError
used by NodeSet when bad range is encountered during a a parse
  RangeSet
Advanced range sets.
  NodeSet
Iterable class of nodes with node ranges support.
Functions [hide private]
 
_NodeSetParse(ns, autostep)
Internal RangeSet generator for NodeSet or nodeset string pattern parsing.
source code
 
expand(pat)
Commodity function that expands a pdsh-like pattern into a list of nodes.
source code
 
fold(pat)
Commodity function that clean dups and fold provided pattern with ranges and "/step" support.
source code
 
_test() source code
Variables [hide private]
  __package__ = 'ClusterShell'