Below is my code, but I cannot get anything to print anything in tasks_exec when running using Python IDLE or Jupyter.
import multiprocessing as mp
from multiprocessing import Process
from multiprocessing import Pool
import time
#Pool
tasks = (["A", 5], ["B", 2], ["C", 1], ["D", 3])
def tasks_exec(tasks_data):
print(f'Process {tasks_data[0]} waiting {tasks_data[1]} seconds')
time.sleep(int(tasks_data[1]))
print(f'Process {tasks_data[1]} finished')
return (tasks_data)
def pool_func():
p = Pool(2)
p.map(tasks_exec, tasks)
print("This works")
if __name__ == '__main__':
pool_func()