Use multiprocessing.cpu_count for max suggestion workers
parent
ce57c1f3ec
commit
a6c6ffa49a
|
@ -3,8 +3,8 @@ COLLECTION_IMPORT_LIMIT = 10
|
|||
|
||||
ITEMS_PER_IMPORT_THREAD = 25
|
||||
|
||||
# Max thread count for data ingest
|
||||
IO_MAX_WORKERS = 10
|
||||
NGRAMS_MAX_WORKERS = 10
|
||||
|
||||
# Size of list of items to process into ngrams per process
|
||||
NGRAMS_PER_PROCESS = 25
|
||||
|
|
|
@ -2,7 +2,7 @@ import concurrent.futures
|
|||
import os
|
||||
import queue
|
||||
import time
|
||||
from multiprocessing import Manager
|
||||
from multiprocessing import Manager, cpu_count
|
||||
from threading import get_ident
|
||||
|
||||
import config
|
||||
|
@ -96,9 +96,7 @@ def run():
|
|||
|
||||
db_pool = concurrent.futures.ThreadPoolExecutor()
|
||||
io_pool = concurrent.futures.ThreadPoolExecutor(max_workers=config.IO_MAX_WORKERS)
|
||||
ngrams_pool = concurrent.futures.ProcessPoolExecutor(
|
||||
max_workers=config.NGRAMS_MAX_WORKERS
|
||||
)
|
||||
ngrams_pool = concurrent.futures.ProcessPoolExecutor(max_workers=cpu_count())
|
||||
|
||||
def shutdown():
|
||||
print("Stopping import.")
|
||||
|
|
Loading…
Reference in New Issue