python 3.x - using dask distributed computing via jupyter notebook -


i seeing strange behavior dask when using jupyter notebook. initiating local client , giving list of jobs do. real code bit complex putting simple example here:

from dask.distributed import client  def inc(x):  return x + 1  if __name__ == '__main__':  c = client()  futures = [c.submit(inc, i) in range(1,10)]  result = c.gather(futures)  print(len(result)) 

the problem that, realize that: 1. dask initiates more 9 processes example. 2. after code has ran , done (nothing in notebook running), processes created dask not killed (and client not shutdown). when top, can see processes still alive.

i saw in documents there client.close() option, interestingly enough, such functionality not exist in 0.15.2.

the time dask processes killed, when stop jupyter notebook. issue causing strange , unpredictable performance behavior. there anyway processes can killed or client shutdown when there no code running on notebook?

the default client allows optional parameters passed localcluster (see docs) , allow specify, example, number of processes wish. also, context manager, close , end processes when done.

with client(n_workers=2) c:     futures = [c.submit(inc, i) in range(1,10)]     result = c.gather(futures)     print(len(result)) 

when ends, processes terminated.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -