Dask “spill to disk” errors

Dask “spill to disk” errors

Dask-enabled notebooks may throw errors such as “No space left on device”. This is caused by Dask spilling data to disk when memory limits are reached.

Option 1: 

Edit the Dask config file to prevent spilling to disk. Open a Terminal from the Sandbox Launcher. Using vi or another text editor of your choice, open dask/distributed.yaml by typing the following code into the Terminal line and pressing the Enter key.


vi ~/.config/dask/distributed.yaml


Use arrow keys to navigate the file and press i to start editing. As instructed here, change the following settings to match:



distributed:

    worker:

       memory:

          target: false  # don't spill to disk

          spill: false  # don't spill to disk

          pause: 0.80  # pause execution at 80% memory use

          terminate: 0.95  # restart the worker at 95% use



Once you have edited the settings, press the following keys: Esc, :, w, q, Enter. This writes to the file then closes it.


Option 2:

Enforce temporary directory filepath to a location outside the user’s home directory. Set the location inside a .ipynb notebook code cell by running the following code:



import dask

dask.config.set({'temporary_directory': '/tmpfs'})