File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change 1313import logging
1414import os
1515import sys
16- from multiprocessing .pool import ThreadPool
17- from multiprocessing import set_start_method
1816
1917from boto3 import client
2018from botocore .exceptions import ClientError , ProfileNotFound , NoCredentialsError
2119
20+ from concurrent .futures import ThreadPoolExecutor
21+
2222region = "us-east-1"
2323ssm_client = client ('ssm' , region_name = region )
2424
@@ -197,11 +197,9 @@ def _load_single_key(key):
197197 ]
198198
199199 # thread pool of 7 to load fetch the keys
200- set_start_method ("spawn" )
201- pool = ThreadPool (7 )
202- results = pool .map (_load_single_key , keys )
203- pool .close ()
204- pool .join ()
200+ with ThreadPoolExecutor (max_workers = 7 ) as executor :
201+ results = list (executor .map (_load_single_key , keys ))
202+ logging .warning (f"got { len (results )} keys" )
205203
206204 # set the variable values at the module level so can be imported as cla.config.{VAR_NAME}
207205 for config_key , result in zip (config_keys , results ):
You can’t perform that action at this time.
0 commit comments