the apply_assync is not working in certain documents

22 Views Asked by At

The apply_assync is not working. If i try to call the function outside of the apply it works perfectly, but in the apply_assync neither one of the functions works and the program blocks, not allowing me to manually stop it either, i have to restart the app altogether. I have this exact code on another document and it works fine, why is it not working here?

if __name__ == "__main__":
    start_time = time.time()
    pool = multiprocessing.Pool(processes=multiprocessing.cpu_count()-1)
    for p in range(10):#range(len(routes)):º
        pool.apply_async(zonegroundtruth,args=(p,stops,routes), callback=collect_results,error_callback=custom_error_callback)
    pool.close()
    pool.join()

Already tried changing function for a simpler one, and the problem remains, the arguments are correct. And i ran this code one another document and it worked

0

There are 0 best solutions below