Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import concurrent.futures
- threadpool = concurrent.futures.ThreadPoolExecutor( max_workers=3 )
- loop = asyncio.get_event_loop()
- # run numpy.save on the thread pool
- save_done = loop.run_in_executor( threadpool, numpy.save, path, data )
- # save_done is an awaitable
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement