Skip to content

Commit 7ded382

Browse files
authored
Merge pull request #6453 from dev-hato/fix_fork_3
fix: multiprocessing.Pool(fork)をThreadPoolExecutorに置き換える
2 parents f853830 + 7720200 commit 7ded382

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

library/hatomap.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from __future__ import annotations
22

33
import math
4-
import multiprocessing
54
import random
65
import string
76
from abc import ABCMeta, abstractmethod
7+
from concurrent.futures import ThreadPoolExecutor
88
from dataclasses import dataclass, field
99
from typing import List, Optional, Tuple
1010

@@ -196,8 +196,8 @@ def request(self, bbox: WebMercatorPixelBBox) -> np.ndarray:
196196
{"x": x, "y": y, "z": bbox.zoom}
197197
)
198198
)
199-
with multiprocessing.get_context(method="fork").Pool(16) as p:
200-
imgs = list(p.imap(self._get_image_content, request_urls))
199+
with ThreadPoolExecutor(max_workers=16) as executor:
200+
imgs = list(executor.map(self._get_image_content, request_urls))
201201

202202
tile_width_cnt = rb_tilepx.tile.tile_x + 1 - tl_tilepx.tile.tile_x
203203
tile_height_cnt = rb_tilepx.tile.tile_y + 1 - tl_tilepx.tile.tile_y

0 commit comments

Comments
 (0)