Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
73c8dd32
Commit
73c8dd32
authored
Mar 03, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix lmdb transaction RAII bug
parent
8008bf4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
tensorpack/dataflow/dftools.py
tensorpack/dataflow/dftools.py
+13
-7
No files found.
tensorpack/dataflow/dftools.py
View file @
73c8dd32
...
...
@@ -67,13 +67,19 @@ def dump_dataflow_to_lmdb(ds, lmdb_path):
except
NotImplementedError
:
sz
=
0
with
get_tqdm
(
total
=
sz
)
as
pbar
:
txn
=
db
.
begin
(
write
=
True
)
for
idx
,
dp
in
enumerate
(
ds
.
get_data
()):
if
(
idx
+
1
)
%
1000
==
0
:
txn
.
commit
()
txn
=
db
.
begin
(
write
=
True
)
txn
.
put
(
u'{}'
.
format
(
idx
)
.
encode
(
'ascii'
),
dumps
(
dp
))
pbar
.
update
()
idx
=
-
1
itr
=
ds
.
get_data
()
try
:
while
True
:
with
db
.
begin
(
write
=
True
)
as
txn
:
for
_
in
range
(
1000
):
idx
+=
1
dp
=
next
(
itr
)
txn
.
put
(
u'{}'
.
format
(
idx
)
.
encode
(
'ascii'
),
dumps
(
dp
))
pbar
.
update
()
except
StopIteration
:
pass
keys
=
[
u'{}'
.
format
(
k
)
.
encode
(
'ascii'
)
for
k
in
range
(
idx
+
1
)]
with
db
.
begin
(
write
=
True
)
as
txn
:
txn
.
put
(
b
'__keys__'
,
dumps
(
keys
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment