From b8fa3dfdd8951811c6cde13ecb0dfcb543db472a Mon Sep 17 00:00:00 2001 From: harsh8398 Date: Tue, 6 Oct 2020 23:07:41 +0530 Subject: [PATCH 1/2] lock: added troubleshooting doc link in error message (#4325) --- dvc/lock.py | 8 +++++--- tests/func/test_lock.py | 9 +++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/dvc/lock.py b/dvc/lock.py index 5ae5d5d2f1..3442725201 100644 --- a/dvc/lock.py +++ b/dvc/lock.py @@ -14,10 +14,12 @@ DEFAULT_TIMEOUT = 3 + FAILED_TO_LOCK_MESSAGE = ( - "cannot perform the command because another DVC process seems to be " - "running on this project. If that is not the case, manually remove " - "`.dvc/tmp/lock` and try again." + "Unable to acquire lock. Most likely another DVC process is running or " + "was terminated abruptly. Check the page {}." +).format( + format_link("https://dvc.org/doc/user-guide/troubleshooting#lock-issue") ) diff --git a/tests/func/test_lock.py b/tests/func/test_lock.py index 188cf65270..bad32189f0 100644 --- a/tests/func/test_lock.py +++ b/tests/func/test_lock.py @@ -1,6 +1,6 @@ import pytest -from dvc.lock import FAILED_TO_LOCK_MESSAGE, Lock, LockError +from dvc.lock import Lock, LockError from dvc.main import main @@ -18,6 +18,11 @@ def test_cli(tmp_dir, dvc, mocker, caplog): # patching to speedup tests mocker.patch("dvc.lock.DEFAULT_TIMEOUT", 0.01) + expected_error_msg = ( + "Unable to acquire lock. Most likely another DVC process is " + "running or was terminated abruptly. Check the page " + "." + ) with Lock(tmp_dir / dvc.tmp_dir / "lock"): assert main(["add", "foo"]) == 1 - assert FAILED_TO_LOCK_MESSAGE in caplog.text + assert expected_error_msg in caplog.text From d64edc04cef2703c8f2724de95a6444908ccf8a9 Mon Sep 17 00:00:00 2001 From: harsh8398 Date: Thu, 15 Oct 2020 20:39:43 +0530 Subject: [PATCH 2/2] updated lock error message (iterative#4325) --- dvc/lock.py | 3 ++- tests/func/test_lock.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dvc/lock.py b/dvc/lock.py index 3442725201..4da7a4102e 100644 --- a/dvc/lock.py +++ b/dvc/lock.py @@ -17,7 +17,8 @@ FAILED_TO_LOCK_MESSAGE = ( "Unable to acquire lock. Most likely another DVC process is running or " - "was terminated abruptly. Check the page {}." + "was terminated abruptly. Check the page {} for other possible reasons " + "and to learn how to resolve this." ).format( format_link("https://dvc.org/doc/user-guide/troubleshooting#lock-issue") ) diff --git a/tests/func/test_lock.py b/tests/func/test_lock.py index bad32189f0..27015258bc 100644 --- a/tests/func/test_lock.py +++ b/tests/func/test_lock.py @@ -21,7 +21,8 @@ def test_cli(tmp_dir, dvc, mocker, caplog): expected_error_msg = ( "Unable to acquire lock. Most likely another DVC process is " "running or was terminated abruptly. Check the page " - "." + " " + "for other possible reasons and to learn how to resolve this." ) with Lock(tmp_dir / dvc.tmp_dir / "lock"): assert main(["add", "foo"]) == 1