Skip to content

Commit 7a93152

Browse files
ptoman-paadchia
authored andcommitted
fix: Closes threadpool resources upon datastore online_write_batch completion (#2386)
Signed-off-by: Pamela Toman <ptoman@paloaltonetworks.com>
1 parent 993b8cc commit 7a93152

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

sdk/python/feast/infra/online_stores/datastore.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,13 @@ def online_write_batch(
159159
write_batch_size = online_config.write_batch_size
160160
feast_project = config.project
161161

162-
pool = ThreadPool(processes=write_concurrency)
163-
pool.map(
164-
lambda b: self._write_minibatch(client, feast_project, table, b, progress),
165-
self._to_minibatches(data, batch_size=write_batch_size),
166-
)
162+
with ThreadPool(processes=write_concurrency) as pool:
163+
pool.map(
164+
lambda b: self._write_minibatch(
165+
client, feast_project, table, b, progress
166+
),
167+
self._to_minibatches(data, batch_size=write_batch_size),
168+
)
167169

168170
@staticmethod
169171
def _to_minibatches(data: ProtoBatch, batch_size) -> Iterator[ProtoBatch]:

0 commit comments

Comments
 (0)