Skip to content

Commit 48d735f

Browse files
committed
Switch to using starmap_async
1 parent f8f6c82 commit 48d735f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pandas_to_postgres/hdf_to_postgres.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,18 @@ def hdf_to_postgres(file_name, engine_args, engine_kwargs={}, keys=[],
115115

116116
try:
117117
p = Pool(processes)
118-
p.starmap(_copy_worker, args, chunksize=1)
118+
result = p.starmap_async(_copy_worker, args, chunksize=1)
119119

120120
finally:
121121
del tables
122122
del hdf
123123
p.close()
124124
p.join()
125125

126+
if not result.successful():
127+
# If there's an exception, throw it, but we don't care about the
128+
# results
129+
result.get()
130+
126131
else:
127132
raise ValueError("processes should be int or None.")

0 commit comments

Comments
 (0)