Multiprocessing List objects

class flockmp.list.ListAsync
classmethod apply(_list, function, poolSize=5)

First we segmentat the orginal List in chunks, then the executeAsync() will parallelize the function’s operations on the segmented lists.

Parameters:
  • _list (list) – Input List
  • fuction (func) – Function to be applied on the list
  • poolSize (int) – Number of pools of processes

Example

_list = list(range(2000))
res = ListAsync.apply(_list, lambda x: x ** 2 / 10)