run_in_threads (
function,
attrs,
processes=1,
group_by=1,
additional_attrs=None,
kw_attrs=None,
)
function is the function to run, attrs a list of attrs for which to run the
consecutively the function, additional_attrs and kw_attrs are attrs that are added to
each call of function, group_by means how many attributes should be processed in one thread, this is useful when a
single run of the function is too fast and the overhead of starting a thread is too high,
it is good to set this value so that a runtime of one group is higher than at least 100ms,
processes is a number of parallel threads that should run.
|