From 0ae9fabdedda9ebb37beb69afffaef1e29276758 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Mon, 23 Feb 2009 22:55:37 +0000 Subject: [PATCH] svn merge -r16649:16660 https://eris.llnl.gov/svn/slurm/branches/slurm-1.3 --- NEWS | 9 +++++- contribs/python/hostlist/CHANGES | 19 ++++++++++++ contribs/python/hostlist/PKG-INFO | 4 ++- contribs/python/hostlist/README | 28 +++++++++++------ contribs/python/hostlist/hostlist.py | 4 +-- contribs/python/hostlist/python-hostlist.spec | 4 ++- contribs/python/hostlist/setup.py | 31 +++++++++++++++++-- .../block_allocator/block_allocator.c | 10 +++--- 8 files changed, 87 insertions(+), 22 deletions(-) diff --git a/NEWS b/NEWS index 96636a8c46a..5a5811e0bc0 100644 --- a/NEWS +++ b/NEWS @@ -189,6 +189,13 @@ documents those changes that are of interest to users and admins. job's required or excluded node specification being ignored. -- Add logic to handle message connect timeouts (timed-out.patch from Chuck Clouston, Bull). + -- Update python-hostlist code from Kent Engström (NSC) to v1.5 + - Add hostgrep utility to search for lines matching a hostlist. + - Make each "-" on the command line count as one hostlist argument. + If multiple hostslists are given on stdin they are combined to a + union hostlist before being used in the way requested by the + options. + * Changes in SLURM 1.3.13 ========================= @@ -349,7 +356,7 @@ documents those changes that are of interest to users and admins. given user with a given name will execute with this dependency type. From Matthieu Hautreux, CEA. -- Updated contribs/python/hostlist to version 1.3: See "CHANGES" file in - that directory for details. From Kent Engstrom, NSC. + that directory for details. From Kent Engström, NSC. -- Add SLURM_JOB_NAME environment variable for jobs submitted using sbatch. In order to prevent the job steps from all having the same name as the batch job that spawned them, the SLURM_JOB_NAME environment variable is diff --git a/contribs/python/hostlist/CHANGES b/contribs/python/hostlist/CHANGES index 29221781824..86f30ec84ab 100644 --- a/contribs/python/hostlist/CHANGES +++ b/contribs/python/hostlist/CHANGES @@ -1,3 +1,22 @@ +Version 1.5 (2009-02-22) + + Make each "-" on the command line count as one hostlist argument. + If multiple hostslists are given on stdin they are combined to a + union hostlist before being used in the way requested by the + options. + + Add hostgrep utility to search for lines matching a hostlist. + + Make the build system (used when building tar.gz and RPMs from the + source code held in git) smarter. + +Version 1.4 (2008-12-28) + + Support Python 3. + + Import reduce from functools if possible. + Use Python 2/3 installation trick from .../Demo/distutils/test2to3 + Version 1.3 (2008-09-30) Add -s/--separator, -p/--prepend, -a/--append and --version diff --git a/contribs/python/hostlist/PKG-INFO b/contribs/python/hostlist/PKG-INFO index cf63530236e..f66980ccb6a 100644 --- a/contribs/python/hostlist/PKG-INFO +++ b/contribs/python/hostlist/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: python-hostlist -Version: 1.3 +Version: 1.5 Summary: Python module for hostlist handling Home-page: http://www.nsc.liu.se/~kent/python-hostlist/ Author: Kent Engström @@ -14,3 +14,5 @@ Classifier: Intended Audience :: System Administrators Classifier: License :: OSI Approved :: GNU General Public License (GPL) Classifier: Topic :: System :: Clustering Classifier: Topic :: System :: Systems Administration +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 3 diff --git a/contribs/python/hostlist/README b/contribs/python/hostlist/README index 933cd164b59..ebb9d52780a 100644 --- a/contribs/python/hostlist/README +++ b/contribs/python/hostlist/README @@ -1,3 +1,6 @@ +INTRODUCTION +============ + The Python module hostlist.py knows how to expand and collect hostlist expressions. Example: @@ -32,22 +35,27 @@ perform set operations on them. Example: n9 n10 -Install directly by running - python setup.py build (as yourself) - python setup.py install (as root) +BUILDING +======== -or just copy the hostlist.py, hostlist and hostlist.1 files to appropriate places. +Build RPM packages from the tar.gz archive by running: -Build RPM packages by running: + rpmbuild -ta python-hostlist-1.5.tar.gz - rpmbuild -ta python-hostlist-VERSION.tar.gz - -If you do not have the tar archive, build RPM packages by running: +If you do not have the tar archive, create it first: python setup.py sdist - cp dist/python-hostlist-VERSION.tar.gz ~/rpmbuild/SOURCES - rpmbuild -ba python-hostlist.spec + rpmbuild -ta dist/python-hostlist-1.5.tar.gz + +You may also install directly by running: + + python setup.py build (as yourself) + python setup.py install (as root) + + +RELEASES AND FEEDBACK +===================== You will find new releases at: diff --git a/contribs/python/hostlist/hostlist.py b/contribs/python/hostlist/hostlist.py index f2c2adac1c3..b3b52033626 100755 --- a/contribs/python/hostlist/hostlist.py +++ b/contribs/python/hostlist/hostlist.py @@ -34,7 +34,7 @@ corner cases the behaviour of this module have not been compared for compatibility with pdsh/dshbak/SLURM et al. """ -__version__ = "1.3" +__version__ = "1.5" import re import itertools @@ -50,7 +50,7 @@ MAX_SIZE = 100000 def expand_hostlist(hostlist, allow_duplicates=False, sort=False): """Expand a hostlist expression string to a Python list. - Exemple: expand_hostlist("n[9-11],d[01-02]") ==> + Example: expand_hostlist("n[9-11],d[01-02]") ==> ['n9', 'n10', 'n11', 'd01', 'd02'] Unless allow_duplicates is true, duplicates will be purged diff --git a/contribs/python/hostlist/python-hostlist.spec b/contribs/python/hostlist/python-hostlist.spec index 7f0efc5f380..9c2ce0df12e 100644 --- a/contribs/python/hostlist/python-hostlist.spec +++ b/contribs/python/hostlist/python-hostlist.spec @@ -1,7 +1,7 @@ %{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} Name: python-hostlist -Version: 1.3 +Version: 1.5 Release: 1 Summary: Python module for hostlist handling Vendor: NSC @@ -45,5 +45,7 @@ rm -rf $RPM_BUILD_ROOT %doc CHANGES %{python_sitelib}/* /usr/bin/hostlist +/usr/bin/hostgrep /usr/share/man/man1/hostlist.1.gz +/usr/share/man/man1/hostgrep.1.gz %changelog diff --git a/contribs/python/hostlist/setup.py b/contribs/python/hostlist/setup.py index 0afd28097a2..57199e70754 100644 --- a/contribs/python/hostlist/setup.py +++ b/contribs/python/hostlist/setup.py @@ -2,8 +2,27 @@ from distutils.core import setup +# Python 2/3 installation trick from .../Demo/distutils/test2to3 +try: + from distutils.command.build_py import build_py_2to3 as build_py +except ImportError: + from distutils.command.build_py import build_py + +try: + from distutils.command.build_scripts import build_scripts_2to3 as build_scripts +except ImportError: + from distutils.command.build_scripts import build_scripts + +# Version +VERSION = "1.5" +if "#" in VERSION: + import sys + sys.stderr.write("Bad version %s\n" % VERSION) + sys.exit(1) + + setup(name = "python-hostlist", - version = "1.3", # Change in hostlist{,.py,.1}, python-hostlist.spec too! + version = VERSION, description = "Python module for hostlist handling", long_description = "The hostlist.py module knows how to expand and collect hostlist expressions.", author = "Kent Engström", @@ -16,8 +35,14 @@ setup(name = "python-hostlist", 'License :: OSI Approved :: GNU General Public License (GPL)', 'Topic :: System :: Clustering', 'Topic :: System :: Systems Administration', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 3', ], py_modules = ["hostlist"], - scripts = ["hostlist"], - data_files = [("share/man/man1", ["hostlist.1"])], + scripts = ["hostlist", "hostgrep"], + data_files = [("share/man/man1", ["hostlist.1", + "hostgrep.1"])], + cmdclass = {'build_py':build_py, + 'build_scripts':build_scripts, + } ) diff --git a/src/plugins/select/bluegene/block_allocator/block_allocator.c b/src/plugins/select/bluegene/block_allocator/block_allocator.c index a17582db49a..ec65675d204 100644 --- a/src/plugins/select/bluegene/block_allocator/block_allocator.c +++ b/src/plugins/select/bluegene/block_allocator/block_allocator.c @@ -2140,13 +2140,14 @@ extern int *find_bp_loc(char* bp_id) #ifdef HAVE_BG_FILES ba_bp_map_t *bp_map = NULL; ListIterator itr; - char *check = bp_id; + char *check = NULL; if(!bp_map_list) { if(set_bp_map() == -1) return NULL; } + check = xstrdup(bp_id); /* with BGP they changed the names of the rack midplane action from * R000 to R00-M0 so we now support both formats for each of the * systems */ @@ -2158,9 +2159,11 @@ extern int *find_bp_loc(char* bp_id) } } #else - if(bp_id[3] != '-') + if(check[3] != '-') { + xfree(check); check = xstrdup_printf("R%c%c-M%c", bp_id[1], bp_id[2], bp_id[3]); + } #endif itr = list_iterator_create(bp_map_list); @@ -2169,9 +2172,8 @@ extern int *find_bp_loc(char* bp_id) break; /* we found it */ list_iterator_destroy(itr); -#ifndef HAVE_BGL xfree(check); -#endif + if(bp_map != NULL) return bp_map->coord; else -- GitLab