Advertisement
Guest User

Untitled

a guest
Dec 13th, 2021
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. import concurrent.futures
  2.  
  3. threadpool = concurrent.futures.ThreadPoolExecutor( max_workers=3 )
  4.  
  5. loop = asyncio.get_event_loop()
  6.  
  7. # run numpy.save on the thread pool
  8. save_done = loop.run_in_executor( threadpool, numpy.save, path, data )
  9. # save_done is an awaitable
  10.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement