Skip to content

Commit

Permalink
fix: Closes threadpool resources upon datastore online_write_batch co…
Browse files Browse the repository at this point in the history
…mpletion (#2386)

Signed-off-by: Pamela Toman <ptoman@paloaltonetworks.com>
  • Loading branch information
ptoman-pa authored and adchia committed Mar 9, 2022
1 parent 993b8cc commit 7a93152
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sdk/python/feast/infra/online_stores/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,13 @@ def online_write_batch(
write_batch_size = online_config.write_batch_size
feast_project = config.project

pool = ThreadPool(processes=write_concurrency)
pool.map(
lambda b: self._write_minibatch(client, feast_project, table, b, progress),
self._to_minibatches(data, batch_size=write_batch_size),
)
with ThreadPool(processes=write_concurrency) as pool:
pool.map(
lambda b: self._write_minibatch(
client, feast_project, table, b, progress
),
self._to_minibatches(data, batch_size=write_batch_size),
)

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

0 comments on commit 7a93152

Please sign in to comment.