airspeed-velocity / asv

Airspeed Velocity: A simple Python benchmarking tool with web-based reporting
https://asv.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
861 stars 180 forks source link

is stdin "closed" intentionally? #802

Open yarikoptic opened 5 years ago

yarikoptic commented 5 years ago

somewhere between v0.2.2 and v0.3b1 asv started to cause stdin being closed in the ran benchmarks, so our suit started to fail with e.g.

$> asv run -j 4 -q -e -b api.supers.time_ls -E existing
· Discovering benchmarks
· Running 3 total benchmarks (1 commits * 1 environments * 3 benchmarks)
[  0.00%] ·· Benchmarking existing-py_home_yoh_proj_datalad_datalad_venvs_dev_bin_python2
[ 16.67%] ··· Setting up api.py:64                                                                                                                                                                                             ok
[ 16.67%] ··· api.supers.time_ls                                                                                                                                                                                           failed
[ 16.67%] ···· Finished setup for /home/yoh/.tmp/tmpuCWXte
               Cleaning up /home/yoh/.tmp/tmpuCWXte/testds10_
               Cleaning up /home/yoh/.tmp/tmpuCWXte/testds10
               Traceback (most recent call last):
                 File "/home/yoh/proj/misc/asv/asv/benchmark.py", line 974, in main_run_server
                   main_run(run_args)
                 File "/home/yoh/proj/misc/asv/asv/benchmark.py", line 888, in main_run
                   result = benchmark.do_run()
                 File "/home/yoh/proj/misc/asv/asv/benchmark.py", line 407, in do_run
                   return self.run(*self._current_params)
                 File "/home/yoh/proj/misc/asv/asv/benchmark.py", line 501, in run
                   min_run_count=self.min_run_count)
                 File "/home/yoh/proj/misc/asv/asv/benchmark.py", line 564, in benchmark_timing
                   timing = timer.timeit(number)
                 File "/usr/lib/python2.7/timeit.py", line 202, in timeit
                   timing = self.inner(it, self.timer)
                 File "/usr/lib/python2.7/timeit.py", line 100, in inner
                   _func()
                 File "/home/yoh/proj/misc/asv/asv/benchmark.py", line 469, in <lambda>
                   func = lambda: self.func(*param)
                 File "/home/yoh/proj/datalad/datalad/benchmarks/api.py", line 112, in time_ls
                   ls(self.ds.path)
                 File "/home/yoh/proj/datalad/datalad/datalad/interface/ls.py", line 149, in __call__
                   return _ls_json(loc, json=json, **kw) if json else _ls_dataset(loc, **kw)
                 File "/home/yoh/proj/datalad/datalad/datalad/interface/ls.py", line 484, in _ls_dataset
                   path_fmt = u"{ds.path!U:<%d}" % (maxpath + (11 if is_interactive() else 0))  # + to accommodate ansi codes
                 File "/home/yoh/proj/datalad/datalad/datalad/utils.py", line 210, in is_interactive
                   return sys.stdin.isatty() and sys.stdout.isatty() and sys.stderr.isatty()
               ValueError: I/O operation on closed file

I wonder if such change in behavior was intentional (which is IMHO a bit too aggressive) or may be just a side-effect?

yarikoptic commented 5 years ago

this causes lots of grief... even can't connect via detached debugger (epdb):

$  asv run -j 4 -e -b api.supers -E existing
...
                 File "/home/yoh/proj/datalad/datalad/benchmarks/api.py", line 88, in setup
                   import epdb; epdb.serve()
                 File "/home/yoh/proj/datalad/datalad/venvs/dev/local/lib/python2.7/site-packages/epdb/__init__.py", line 1084, in serve
                   Epdb().serve(port)
                 File "/home/yoh/proj/datalad/datalad/venvs/dev/local/lib/python2.7/site-packages/epdb/__init__.py", line 150, in serve
                   Epdb._server.handle_request()
                 File "/home/yoh/proj/datalad/datalad/venvs/dev/local/lib/python2.7/site-packages/epdb/epdb_server.py", line 238, in handle_request
                   self._serve_process(err.slaveFd, err.serverPid)
                 File "/home/yoh/proj/datalad/datalad/venvs/dev/local/lib/python2.7/site-packages/epdb/epdb_server.py", line 251, in _serve_process
                   if sys.stdin.isatty():
               ValueError: I/O operation on closed file

so question remains - if intentional or not (then should be fixed)