rsaw
rsaw

Reputation: 134

Dask Future has state "cancelled" without having been cancelled

Im am building a dask application and using the Dask SSH-Cluster as a Cluster. When I run a task in Dask and try to await it, it causes a concurrent.futures._base.CancelledError Error.

My Code is the following:

def run_custom_task():
    return "aa"


def main():
    cluster = SSHCluster(hosts=['localhost', 'pi01.local'],
                         connect_options=[{'username': 'abc'}, {'username': 'pi'}],
                         worker_options={
                             "nprocs": 1,
                             "nthreads": 1
                         }, 
                         remote_python="/usr/bin/python3")
    client = Client(cluster)

    res = client.submit(run_custom_task)
    print(res.result())

The exact error I receive is:

Traceback (most recent call last):
  File "test.py", line 65, in <module>
    main()
  File "test.py", line 59, in main
    x = res.result()
  File "/home/rohan/.local/lib/python3.8/site-packages/distributed/client.py", line 222, in result
    raise result
concurrent.futures._base.CancelledError: run_custom_task-966de894af6e709f1e8067f6e9ffe68

so it seems that the future for this task is being cancelled somehow.

Thanks in advance!

Upvotes: 2

Views: 1554

Answers (1)

rsaw
rsaw

Reputation: 134

I actually managed to solve this problem already: The problem was that the dask.distributed and dask version were different (2021.04.0 and 2021.05.0) after installing the same version this error was solved.

Upvotes: 2

Related Questions