Skip to content

Suppress stack trace for KeyboardInterrupt #2792

@dmpetrov

Description

@dmpetrov
  1. When canceling (Ctrl+C) dvc pull you see Python exception in the output. It is better to avoid it (UX issue).
  2. EDITED: it looks like this was fixed in later versions (see my commend below) The command was not actually canceled after the first Ctrl+C - dvc pull was still running. I had to push Ctrl+C many times (with additional exceptions in the output) before it was actually canceled.

Ideally, after Ctrl+C user should see 1-2 lines about the operation cancelation and command exit.

$ dvc pull

date
 39%|███▊      |s3://dvc-private/re780406/2017219 [44:27<1:01:15,   336file/s] 39%|███▊      |s3://dvc-private/re780805/2017219 [44:29<1:25:30,   241file/s] 39%|███▊      |s3://dvc-private/re780867/2017219 [44:29<1:16:04,   271file/s]^CTraceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py", line 586, in result_iterator
    yield fs.pop().result()
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py", line 427, in result
    self._condition.wait(timeout)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 296, in wait
    waiter.acquire()
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/dmitry/src/dvc/dvc/remote/base.py", line 738, in cache_exists
^C  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py", line 591, in result_iterator
    future.cancel()
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py", line 362, in cancel
    self._condition.notify_all()
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 365, in notify_all
    self.notify(len(self._waiters))
KeyboardInterrupt

During handling of the above exception, another exception occurred:

^CError in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py", line 40, in _python_exit
    t.join()
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 1032, in join
    self._wait_for_tstate_lock()
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 1048, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
KeyboardInterrupt
^C

Metadata

Metadata

Assignees

No one assigned

    Labels

    p1-importantImportant, aka current backlog of things to douiuser interface / interaction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions