Trigger-Discipline: parallelize result plotting
This commit is contained in:
12
parallel_plot_helper.py
Normal file
12
parallel_plot_helper.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import multiprocessing
|
||||
|
||||
|
||||
def run_plot_task(task):
|
||||
func, args = task
|
||||
return func(*args)
|
||||
|
||||
|
||||
def run_plot_tasks_parallel(plot_tasks):
|
||||
ctx = multiprocessing.get_context('fork')
|
||||
with ctx.Pool() as pool:
|
||||
pool.map(run_plot_task, plot_tasks)
|
||||
Reference in New Issue
Block a user