Skip to content

Commit

Permalink
Rephrase error message
Browse files Browse the repository at this point in the history
  • Loading branch information
algomaster99 committed Nov 14, 2019
1 parent 1ca054c commit 13ddcd4
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions dvc/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import time
from datetime import timedelta

import colorama
from funcy.py3 import lkeep

from dvc.exceptions import DvcException
Expand All @@ -16,11 +15,11 @@

DEFAULT_TIMEOUT = 5

ERROR_MESSAGE = (
"cannot perform the cmd since DVC is busy and 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)
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/lock` and try again."
)


class LockError(DvcException):
Expand Down Expand Up @@ -78,7 +77,7 @@ def lock(self):
try:
super(Lock, self).lock(timedelta(seconds=DEFAULT_TIMEOUT))
except flufl.lock.TimeOutError:
raise LockError(ERROR_MESSAGE)
raise LockError(FAILED_TO_LOCK_MESSAGE)

def _set_claimfile(self, pid=None):
super(Lock, self)._set_claimfile(pid)
Expand Down Expand Up @@ -123,7 +122,7 @@ def _do_lock(self):
try:
self._lock = zc.lockfile.LockFile(self.lockfile)
except zc.lockfile.LockError:
raise LockError(ERROR_MESSAGE)
raise LockError(FAILED_TO_LOCK_MESSAGE)

def lock(self):
try:
Expand Down

0 comments on commit 13ddcd4

Please sign in to comment.