mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
Move error message to a constant
This commit is contained in:
+8
-16
@@ -16,6 +16,12 @@ from dvc.utils.compat import is_py3
|
||||
|
||||
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)
|
||||
|
||||
|
||||
class LockError(DvcException):
|
||||
"""Thrown when unable to acquire the lock for dvc repo."""
|
||||
@@ -72,14 +78,7 @@ if is_py3:
|
||||
try:
|
||||
super(Lock, self).lock(timedelta(seconds=DEFAULT_TIMEOUT))
|
||||
except flufl.lock.TimeOutError:
|
||||
raise LockError(
|
||||
"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
|
||||
)
|
||||
)
|
||||
raise LockError(ERROR_MESSAGE)
|
||||
|
||||
def _set_claimfile(self, pid=None):
|
||||
super(Lock, self)._set_claimfile(pid)
|
||||
@@ -124,14 +123,7 @@ else:
|
||||
try:
|
||||
self._lock = zc.lockfile.LockFile(self.lockfile)
|
||||
except zc.lockfile.LockError:
|
||||
raise LockError(
|
||||
"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
|
||||
)
|
||||
)
|
||||
raise LockError(ERROR_MESSAGE)
|
||||
|
||||
def lock(self):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user