From 7f12ef85397a1400fac2eb2eba6ba36f943531e9 Mon Sep 17 00:00:00 2001 From: Aman Sharma Date: Sat, 9 Nov 2019 04:28:41 +0530 Subject: [PATCH] Improve error message when `LockError` is raised --- dvc/lock.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dvc/lock.py b/dvc/lock.py index 27ca67229..dc6c52b23 100644 --- a/dvc/lock.py +++ b/dvc/lock.py @@ -6,6 +6,7 @@ import os import time from datetime import timedelta +import colorama from funcy.py3 import lkeep from dvc.exceptions import DvcException @@ -73,7 +74,11 @@ if is_py3: except flufl.lock.TimeOutError: raise LockError( "cannot perform the cmd since DVC is busy and " - "locked. Please retry the cmd later." + "locked. You can delete .dvc/lock to fix it, but first " + "please make sure there's no other dvc process ongoing " + "by running: {blue}`ps xaf | grep dvc`{nc}.".format( + blue=colorama.Back.BLUE, nc=colorama.Back.RESET + ) ) def _set_claimfile(self, pid=None): @@ -121,7 +126,11 @@ else: except zc.lockfile.LockError: raise LockError( "cannot perform the cmd since DVC is busy and " - "locked. Please retry the cmd later." + "locked. You can delete .dvc/lock to fix it, but first " + "please make sure there's no other dvc process ongoing " + "by running: {blue}`ps xaf | grep dvc`{nc}.".format( + blue=colorama.Back.BLUE, nc=colorama.Back.RESET + ) ) def lock(self):