Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify the directory that dask uses for temporary files?

Tags:

dask

Dask seems to write to the /tmp folder. How can I change the folder that dask uses for temporary files?

like image 919
Arco Bast Avatar asked Oct 14 '16 12:10

Arco Bast


3 Answers

Setting TMPDIR could potentially cause problems as it might also effect other applications. An alternative is to use dask.config.set

>>> import dask
>>> with dask.config.set({'temporary_directory': '/path/to/tmp'}):
...     pass

You could also add the lines

temporary_directory: /path/to/tmp

to .dask/config.yaml (in your home directory) configuration docs

like image 61
danodonovan Avatar answered Jan 03 '23 07:01

danodonovan


For some reason the accepted code doesn't work for me. I get this error: AttributeError: 'set' object has no attribute 'items'

Here's a version that works: dask.config.set(temporary_directory='/path/to/tmp')

Also note that you have to do this before you create your Client.

like image 23
Alexei Andreev Avatar answered Jan 03 '23 05:01

Alexei Andreev


Setting the TMPDIR environment variable to the desired location via export TMPDIR=/my/path seems to work.

like image 20
Arco Bast Avatar answered Jan 03 '23 07:01

Arco Bast