diff --git a/README.rst b/README.rst index 85868176722bd..da789e704ebad 100644 --- a/README.rst +++ b/README.rst @@ -99,8 +99,8 @@ Optional dependencies - `BeautifulSoup4`_ and `html5lib`_ (Any recent version of `html5lib`_ is okay.) - - `BeautifulSoup4`_ and `lxml`_ - - `BeautifulSoup4`_ and `html5lib`_ and `lxml`_ + - `BeautifulSoup4`_ and `lxml`_ + - `BeautifulSoup4`_ and `html5lib`_ and `lxml`_ - Only `lxml`_, although see :ref:`HTML reading gotchas ` for reasons as to why you should probably **not** take this approach. diff --git a/pandas/core/series.py b/pandas/core/series.py index 15a425fb3fd73..b77dfbfd9618c 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -567,7 +567,7 @@ def axes(self): @property def ix(self): - if self._ix is None: + if self._ix is None: # defined in indexing.py; pylint: disable=E0203 self._ix = _SeriesIndexer(self, 'ix') return self._ix diff --git a/vb_suite/test_perf.py b/vb_suite/test_perf.py index a24eefa21aca3..f171f48410ce0 100755 --- a/vb_suite/test_perf.py +++ b/vb_suite/test_perf.py @@ -98,17 +98,15 @@ dest='hrepeats', default=1, type=int, - help='Implies -H, number of times to run the vbench suite on the head commit.\n' - 'Each iteration will yield another column in the output.' - ) + help='implies -H, number of times to run the vbench suite on the head commit.\n' + 'Each iteration will yield another column in the output' ) parser.add_argument('-a', '--affinity', metavar="a", dest='affinity', default=1, type=int, - help='Set processor affinity of the process. THe default is to bind to cpu/core #1 only.' - 'requires the "affinity" python module.' ) - + help='set processor affinity of process by default bind to cpu/core #1 only. ' + 'Requires the "affinity" or "psutil" python module, will raise Warning otherwise') parser.add_argument('-u', '--burnin', metavar="u", dest='burnin', @@ -388,14 +386,38 @@ def main(): random.seed(args.seed) np.random.seed(args.seed) + affinity_set = False + + # try psutil first since it is more commonly present and better + # maintained. Some people experienced problems with affinity package + # (see https://code.google.com/p/psutil/issues/detail?id=238 for more references) try: - import affinity - affinity.set_process_affinity_mask(0,args.affinity) - assert affinity.get_process_affinity_mask(0) == args.affinity - print("CPU affinity set to %d" % args.affinity) + import psutil + if hasattr(psutil.Process, 'set_cpu_affinity'): + psutil.Process(os.getpid()).set_cpu_affinity([args.affinity]) + affinity_set = True except ImportError: - print("Warning: The 'affinity' module is not available.") + pass + + if not affinity_set: + try: + import affinity + affinity.set_process_affinity_mask(0, args.affinity) + assert affinity.get_process_affinity_mask(0) == args.affinity + affinity_set = True + except ImportError: + pass + + if not affinity_set: + import warnings + warnings.warn("\n\n" + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" + "The 'affinity' or 'psutil' >= 0.5.0 modules are not available, results may be unreliable\n" + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n" + ) time.sleep(2) + else: + print("CPU affinity set to %d" % args.affinity) print("\n") prprint("LOG_FILE = %s" % args.log_file)