From 924323f54f102d765f1350b2172cf8c3792346dd Mon Sep 17 00:00:00 2001 From: Harsh Patel Date: Mon, 19 Oct 2020 23:17:08 +0530 Subject: [PATCH] lock: added troubleshooting doc link in error message (#4325) (#4721) * lock: added troubleshooting doc link in error message (#4325) * updated lock error message (iterative#4325) --- dvc/lock.py | 9 ++++++--- tests/func/test_lock.py | 10 ++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/dvc/lock.py b/dvc/lock.py index 59e27679de..ef2232de0b 100644 --- a/dvc/lock.py +++ b/dvc/lock.py @@ -15,10 +15,13 @@ 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 {} 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 188cf65270..27015258bc 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,12 @@ 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 " + " " + "for other possible reasons and to learn how to resolve this." + ) 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