Executes f(a) for a in args using a threadpool to execute in parallel. The pool uses the smaller of 4 and the number of CPUs in the system as the pool size.
(f, args)
| 431 | |
| 432 | |
| 433 | def execute_many(f, args): |
| 434 | """ |
| 435 | Executes f(a) for a in args using a threadpool to execute in parallel. |
| 436 | The pool uses the smaller of 4 and the number of CPUs in the system |
| 437 | as the pool size. |
| 438 | """ |
| 439 | pool = multiprocessing.pool.ThreadPool(processes=min(multiprocessing.cpu_count(), 4)) |
| 440 | return pool.map(f, args, 1) |
| 441 | |
| 442 | |
| 443 | def create_directory_from_env_var(env_var): |
no test coverage detected