fmultiprocess (function)

fmultiprocess(log, function, inputArray, poolSize=False, timeout=3600, **kwargs)[source]

multiprocess pool

Key Arguments

  • log – logger

  • function – the function to multiprocess

  • inputArray – the array to be iterated over

  • poolSize – limit the number of CPU that are used in multiprocess job

  • timeout – time in sec after which to raise a timeout error if the processes have not completed

Return

  • resultArray – the array of results

Usage

from fundamentals import multiprocess
# DEFINE AN INPUT ARRAY
inputArray = range(10000)
results = multiprocess(log=log, function=functionName, poolSize=10, timeout=300,
                      inputArray=inputArray, otherFunctionKeyword="cheese")