Skip to content

Commit

Permalink
multiprocessing.Poolを閉じる際にterminateも行う
Browse files Browse the repository at this point in the history
  • Loading branch information
massongit authored Oct 12, 2024
1 parent dfa01dd commit 5eb0dc7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion library/hatomap.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,12 @@ def request(self, bbox: WebMercatorPixelBBox) -> np.ndarray:
{"x": x, "y": y, "z": bbox.zoom}
)
)
with Pool(16) as p:
try:
p = Pool(16)
imgs = list(p.imap(self._get_image_content, request_urls))
finally:
p.close()
p.terminate()

tile_width_cnt = rb_tilepx.tile.tile_x + 1 - tl_tilepx.tile.tile_x
tile_height_cnt = rb_tilepx.tile.tile_y + 1 - tl_tilepx.tile.tile_y
Expand Down

0 comments on commit 5eb0dc7

Please sign in to comment.