You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LocalCluster not respecting dask distributed config #2456
Running dask.config.set to update the worker memory targets does not seem to affect the worker limits in Cluster, and the config is not respected (despite being represented in the print)
import dask
from dask.datasets import timeseries
from distributed import LocalCluster, Client
dask.config.set({'distributed.worker.memory.target': False, 'distributed.worker.memory.spill': False})
print(dask.config.config['distributed']['worker']['memory'])
cluster = LocalCluster(n_workers=4, threads_per_worker=2, memory_limit='1G')
client = Client(cluster)
dfs = []
for i in range(60):
dfs.append(client.persist(timeseries()))
I would have expected the code above to cause the workers to die and have some errors about memory, but I'm getting nothing. And subsequent calls, eg.
for x in dfs:
print(x.size.compute())
Now take lots of time (data didn't fit in to memory, and is being loaded from disk).
How can I, in python, spin up a LocalCluster with no-spill settings?
Today you can pass the appropriate keyword arguments with the worker_kwargs= parameter to LocalCluster. See the Worker docstring for arguments like memory_spill=
It seems reasonable for us to pass the local configuration into the workers as we create them. This isn't implemented, but seems in scope.
On Thu, Jan 10, 2019 at 2:47 PM Justin Waugh ***@***.***> wrote:
For 1. I was not able to get it to work.
I tried:
cluster = LocalCluster(n_workers=4, threads_per_worker=2, memory_limit = '1G', memory_target_fraction=False, memory_spill_fraction=False)
but I got an error (compatibility with Nanny?)
~/venv/lib/python3.7/site-packages/distributed/deploy/local.py in _start_worker(self, death_timeout, **kwargs)
212 w = W(self.scheduler.address, loop=self.loop,
213 death_timeout=death_timeout,
--> 214 silence_logs=self.silence_logs, **kwargs)
215 yield w._start()
216
~/venv/lib/python3.7/site-packages/distributed/nanny.py in __init__(self, scheduler_ip, scheduler_port, scheduler_file, worker_port, ncores, loop, local_dir, services, name, memory_limit, reconnect, validate, quiet, resources, silence_logs, death_timeout, preload, preload_argv, security, contact_address, listen_address, worker_class, env, **kwargs)
98 super(Nanny, self).__init__(handlers, io_loop=self.loop,
99 connection_args=self.connection_args,
--> 100 **kwargs)
101
102 if self.memory_limit:
TypeError: __init__() got an unexpected keyword argument 'memory_target_fraction'
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2456 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AASszKxWk9UTo_AQQnTeSQXHpjqQ4KDrks5vB8L9gaJpZM4Z6IW6>
.
Maybe I'm looking at the wrong thing or am being slow today, but I haven't been able to get this to work and I don't see what you mean about passing these into worker_kwargs keyword directly...
Additionally, I have no problem with the memory_limit kwarg (which is also passed along through worker_kwargs), it just seems to be the memory_target_fraction and memory_spill_fraction causing an issue.
Ah my apologies. Indeed you're correct. It looks like the Nanny doesn't
pass things through properly. This is a bug.
We could solve this in one of two ways:
1. Pass through these keywords explicitly
2. Consider passing through keywords in a more holistic fashion. Having
to replicate all Worker keywords in Nanny seems like it's somewhat
troublesome.
I'm finding a lot of value in dynamically spinning up clusters via python (when using large machines), and having code-able configuration helps ensure behavior is predictable for each sub-cluster.
The main use case for why I am spinning up multiple clusters at once on a single machine, is because I found that a single scheduler ends up being a bottle-neck, and since I have isolatable tasks on different sets of data, separating the work based on the data and tasks helps increase speed and parallelism without the bottle-neck.
No update from me. I don't plan to work on this personally near term (I'm slammed for the forseeable future). If anyone has time to take one of the approaches listed above that would be welcome.
@zyxue - please search for similar questions.
We can't really guess at what your situation might be, but you should be aware that Dask has no control over how much memory might be allocated within a running task (such as intermediate copies), so keep that in mind when designing your workflow.
Activity
mrocklin commentedon Jan 10, 2019
You raise a good point. Some solutions:
worker_kwargs=parameter toLocalCluster. See theWorkerdocstring for arguments likememory_spill=bluecoconut commentedon Jan 10, 2019
For 1. I was not able to get it to work.
I tried:
but I got an error (compatibility with Nanny?)
mrocklin commentedon Jan 11, 2019
bluecoconut commentedon Jan 11, 2019
Maybe I'm looking at the wrong thing or am being slow today, but I haven't been able to get this to work and I don't see what you mean about passing these into
worker_kwargskeyword directly...According Docstrings and method signatures I found ( http://distributed.dask.org/en/latest/local-cluster.html and https://github.com/dask/distributed/blob/master/distributed/deploy/local.py ) it shows the
worker_kwargsin the__init__method as the named "catch all" for the magic**kwarg(specifically:**worker_kwargs). Wouldn't this imply that simply adding named-arguments to the declaration (as done in my example above), put the keys into the worker_kwargs dictionary?Additionally, I have no problem with the
memory_limitkwarg (which is also passed along throughworker_kwargs), it just seems to be thememory_target_fractionandmemory_spill_fractioncausing an issue.mrocklin commentedon Jan 11, 2019
bluecoconut commentedon Jan 30, 2019
Any updates on possibly fixing this?
I'm finding a lot of value in dynamically spinning up clusters via python (when using large machines), and having code-able configuration helps ensure behavior is predictable for each sub-cluster.
The main use case for why I am spinning up multiple clusters at once on a single machine, is because I found that a single scheduler ends up being a bottle-neck, and since I have isolatable tasks on different sets of data, separating the work based on the data and tasks helps increase speed and parallelism without the bottle-neck.
mrocklin commentedon Jan 30, 2019
No update from me. I don't plan to work on this personally near term (I'm slammed for the forseeable future). If anyone has time to take one of the approaches listed above that would be welcome.
bchu commentedon Apr 8, 2019
@bluecoconut With #2596, the kwargs (e.g.
memory_target_fraction, etc.) are now being passed through to the Worker.bluecoconut commentedon Apr 8, 2019
Awesome! thank you~
zyxue commentedon Apr 21, 2019
Any update on this, please? I am using dask-1.2.0, still seeing memory getting out of control
My code for creating a local cluster:
Then, there doesn't seem to be any control looking at the workers status at 8787
martindurant commentedon Apr 21, 2019
@zyxue - please search for similar questions.
We can't really guess at what your situation might be, but you should be aware that Dask has no control over how much memory might be allocated within a running task (such as intermediate copies), so keep that in mind when designing your workflow.
mrocklin commentedon Apr 27, 2019
@zyxue I recommend raising a new issue with your situation