Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit a512411

Browse files
authored
Use dumb dbm driver for all platforms (#134)
* Use dumb dbm driver for all platforms * Added py2.7 compatibility fallback
1 parent 39b6b2d commit a512411

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

CHANGES.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
X.XX.X (YYYY MM DD)
2-
===================
1+
1.13.4 (2018 August 9)
2+
=====================
3+
4+
Bugfixes
5+
--------
6+
* Enforce ``shelve`` to use ``dbm.dumb``/``dumbdbm`` modules for Python 3.x/2.7 respectively to prevent hiccups on a big amount of generated checkpoint. Was caught on macos X (``ndbm`` backend).
37

48
Enhancements
59
------------

datarobot_batch_scoring/writer.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
WriterQueueMsg, ProgressQueueMsg, REPORT_INTERVAL
1818
from datarobot_batch_scoring.utils import get_rusage
1919

20+
if six.PY3:
21+
import dbm.dumb as dumb_dbm
22+
else:
23+
import dumbdbm as dumb_dbm
24+
2025

2126
class ShelveError(Exception):
2227
pass
@@ -83,7 +88,8 @@ def __enter__(self):
8388
assert(not self.is_open)
8489
self.is_open = True
8590
self._ui.debug('ENTER CALLED ON RUNCONTEXT')
86-
self.db = shelve.open(self.file_context.file_name, writeback=True)
91+
raw_db = dumb_dbm.open(self.file_context.file_name)
92+
self.db = shelve.Shelf(raw_db, writeback=True)
8793
if not hasattr(self, 'partitions'):
8894
self.partitions = []
8995
return self

0 commit comments

Comments
 (0)