Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/pyff/builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from lxml.etree import DocumentInvalid
from str2bool import str2bool

from pyff.constants import NS
from pyff.constants import NS, config
from pyff.decorators import deprecated
from pyff.exceptions import MetadataException
from pyff.logs import get_log
Expand Down Expand Up @@ -111,7 +111,7 @@ def _p(e):

from multiprocessing.pool import ThreadPool

pool = ThreadPool()
pool = ThreadPool(config.map_threads)
result = pool.map(_p, iter_entities(req.t), chunksize=10)
log.info(f"processed {len(result)} entities")

Expand Down
4 changes: 4 additions & 0 deletions src/pyff/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ class Config:
"info_buffer_size", default=10, typeconv=as_int, info="how much history to keep about each metadata URL"
)

map_threads = S(
"map_threads", typeconv=as_int, info="how many threads to create in map pipe [default: os.process_cpu_count() ]"
)

worker_pool_size = S(
"worker_pool_size", default=1, cmdline=['pyffd'], typeconv=as_int, info="how many gunicorn workers to run"
)
Expand Down
Loading