Skip to content

Commit 172ee2c

Browse files
committed
Replace multiproccessing with concurrent.futures.
1 parent cdd7da1 commit 172ee2c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

spanner/cloud-client/batch_sample.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"""
2020

2121
import argparse
22-
from multiprocessing.pool import ThreadPool
22+
from concurrent.futures import ThreadPoolExecutor
2323
import time
2424

2525
from google.cloud import spanner
@@ -48,8 +48,8 @@ def run_batch_query(instance_id, database_id):
4848
keyset=spanner.KeySet(all_=True)
4949
)
5050

51-
# pool = multiprocessing.Pool()
52-
pool = ThreadPool()
51+
# Create a pool of workers for the tasks
52+
pool = ThreadPoolExecutor()
5353
results = []
5454
start = time.time()
5555

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
google-cloud-spanner==1.1.0
2+
futures==3.2.0

0 commit comments

Comments
 (0)