File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from __future__ import annotations
22
33import math
4- import multiprocessing
54import random
65import string
76from abc import ABCMeta , abstractmethod
7+ from concurrent .futures import ThreadPoolExecutor
88from dataclasses import dataclass , field
99from 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
You can’t perform that action at this time.
0 commit comments