1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
INTRODUCTION
============
The Python module hostlist.py knows how to expand and collect hostlist
expressions, such as those used by Slurm and related programs. Example:
% python
Python 2.5.1 (r251:54863, Jul 10 2008, 17:24:48)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import hostlist
>>> hosts = hostlist.expand_hostlist("n[1-10,17]")
>>> hosts
['n1', 'n2', 'n3', 'n4', 'n5', 'n6', 'n7', 'n8', 'n9', 'n10', 'n17']
>>> hostlist.collect_hostlist(hosts)
'n[1-10,17]'
>>> hostlist.collect_hostlist(["x1y1","x2y2", "x1y2", "x2y1"])
'x[1-2]y[1-2]'
Bad hostlists or hostnames will result in the hostlist.BadHostlist
exception being raised.
The 'hostlist' command is provided to expand/collect hostlists and
perform set operations on them. Example:
% hostlist n[1-10] n[5-20]
n[1-20]
% hostlist --difference n[1-10] n[5-20]
n[1-4]
% hostlist --expand --intersection n[1-10] n[5-20]
n5
n6
n7
n8
n9
n10
BUILDING
========
Build RPM packages from the tar.gz archive by running:
rpmbuild -ta python-hostlist-2.2.1.tar.gz
If you do not have the tar archive, create it first:
python setup.py sdist
rpmbuild -ta dist/python-hostlist-2.2.1.tar.gz
If you have cloned the git repository, you should also be
able to build RPM packages using "make rpms".
You may also install directly by running the following commands
if you have unpacked a tarball:
python setup.py build (as yourself)
python setup.py install (as root)
If you have cloned the git repository, you will have to do
make prepare; cd versioned
before building/installing via setup.py.
RELEASES AND FEEDBACK
=====================
You will find new releases at:
http://www.nsc.liu.se/~kent/python-hostlist/
If you have questions, suggestions, bug reports or patches, please
send them to:
kent@nsc.liu.se.
|