Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5767875

Browse filesBrowse files
committed
MNT: tweak lock
- increase retries, but back off backoff - add verbose error message
1 parent 56a932c commit 5767875
Copy full SHA for 5767875

File tree

Expand file treeCollapse file tree

1 file changed

+16
-7
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-7
lines changed

‎lib/matplotlib/cbook.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook.py
+16-7Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2554,6 +2554,13 @@ def get_label(y, default_name):
25542554
def _putmask(a, mask, values):
25552555
return np.copyto(a, values, where=mask)
25562556

2557+
_lockstr = """\
2558+
LOCKERROR: matplotlib is trying to acquire the lock {!r}
2559+
and has failed. This maybe due to any other process holding this
2560+
lock. If you are sure no other matplotlib process in running try
2561+
removing this folder(s) and trying again.
2562+
"""
2563+
25572564

25582565
class Locked(object):
25592566
"""
@@ -2565,29 +2572,31 @@ class Locked(object):
25652572
All Rights Reserved
25662573
25672574
conda is distributed under the terms of the BSD 3-clause license.
2568-
Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
2575+
Consult LICENSE_CONDA or http://opensource.org/licenses/BSD-3-Clause.
25692576
"""
2577+
LOCKFN = '.matplotlib_lock'
2578+
25702579
def __init__(self, path):
2571-
LOCKFN = '.matplotlib_lock'
25722580
self.path = path
25732581
self.end = "-" + str(os.getpid())
2574-
self.lock_path = os.path.join(self.path, LOCKFN + self.end)
2575-
self.pattern = os.path.join(self.path, LOCKFN + '-*')
2582+
self.lock_path = os.path.join(self.path, self.LOCKFN + self.end)
2583+
self.pattern = os.path.join(self.path, self.LOCKFN + '-*')
25762584
self.remove = True
25772585

25782586
def __enter__(self):
2579-
retries = 10
2587+
retries = 50
25802588
sleeptime = 1
25812589
while retries:
25822590
files = glob.glob(self.pattern)
25832591
if files and not files[0].endswith(self.end):
25842592
time.sleep(sleeptime)
2585-
sleeptime *= 2
2593+
sleeptime *= 1.1
25862594
retries -= 1
25872595
else:
25882596
break
25892597
else:
2590-
raise RuntimeError(lockstr)
2598+
err_str = _lockstr.format(self.pattern)
2599+
raise RuntimeError(err_str)
25912600

25922601
if not files:
25932602
try:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.