Skip to content
Snippets Groups Projects
Forked from an inaccessible project.
Thomas Bellman's avatar
Thomas Bellman authored
This function takes an "LLNL hostlist" as parameter, and returns the
expansion of it as a list of the items the parameter represents.

An LLNL hostlist is a compact string representation for a set of many
items (typically host names), in particular when the items are names
in combination with one or more sequence numbers.  A few examples:

    LLNL hostlist: foo[8-11]
    Meaning:       foo8, foo9, foo10, foo11

    LLNL hostlist: rack[01-3]-node[01-2,5]
    Meaning:       rack01-node01, rack01-node02, rack01-node5,
                   rack02-node01, rack02-node02, rack02-node5,
                   rack03-node01, rack03-node02, rack03-node5

    LLNL hostlist: d[1-5],n[01-05]
    Meaning:       d1, d2, d3, d4, d5, n01, n02, n03, n04, n05

This syntax is used by several programs originating at the Lawrence
Livermore National Laboratory, used for dealing with HPC clusters,
e.g. the batch queue system SLURM, or the pdsh program for running
a command on many nodes using ssh in parallel.

The implementation of this function is a pretty straight translation
of the "python-hostlist" Python module into Ruby.  Python-hostlist is
written mainly by Kent Engström at National Supercomputer Centre (NSC)
in Sweden.  It is free software, released under the GNU Public License
version 2 or later; thus we can release it here under GPL v3+.  Python-
hostlist can be found at https://www.nsc.liu.se/~kent/python-hostlist/,
with Git repository at git://www.nsc.liu.se/~kent/python-hostlist.git.

There are half a dozen people who have made contributions to the
python-hostlist package, but the only ones who have touched the code
doing the actual parsing and expansion of LLNL hostlist are Kent and
Torbjörn Lönnemark, thus they are the only ones included in the list
of copyright holders at the beginning of the file (plus me, who have
done the translation into Ruby).

A difference from the python-hostlist function, is that this version
*always* sorts the result, and *always* removes duplicates.  No option
is offered for those, as I believe there are no real use-cases for not
sorting or for keeping duplicates.
14645e76
History
Name Last commit Last update