3
from dask.distributed import Client, SSHCluster
cluster = SSHCluster(["localhost", "192.168.x.x"],
connect_options={"known_hosts": None, "username": "xxxx", "client_keys": "~/.ssh/dask" },
worker_options={"nthreads": 2},
scheduler_options={"port": 0, "dashboard_address": ":8797"})
client = Client(cluster)

Getting error

 File "/home/naveen/anaconda3/envs/dask_env/lib/python3.8/site-packages/asyncssh/connection.py", line 218, in _connect
    await conn.wait_established()
  File "/home/naveen/anaconda3/envs/dask_env/lib/python3.8/site-packages/asyncssh/connection.py", line 2096, in wait_established
    await self._waiter
asyncssh.misc.PermissionDenied: Permission denied
sophros
  • 14,672
  • 11
  • 46
  • 75

1 Answers1

1

client_keys must be a list and point to the private key file!

From the docs:

A list of keys to use to authenticate this client via host-based authentication. The simplest option is to pass the name of a file to read one or more private keys from.

More information on all options can be found here and here.

Here is the updated code:

from dask.distributed import Client, SSHCluster

cluster = SSHCluster(
    ["localhost", "192.168.x.x"],
    connect_options={
        "known_hosts": None,
        "username": "xxxx",
        "client_keys": ["~/.ssh/dask/id_rsa"], # <--- HERE!
    },
)

client = Client(cluster)

In my opinion the user experience and error management of asyncssh.connect (and as an extension SSHCluster) could be better in this regard.

JulianWgs
  • 961
  • 1
  • 14
  • 25