dask / dask/distributed

Wrapped `Future.result` hangs in remote function call

Open
#4,842 16 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.7k
Forks
778
Avg merge
2h 50m
Merged PRs (30d)
3

Description

**What happened**: Execution is hangs when I try to call `result` method of Future which is wrapped in some object.

**What you expected to happen**: Successful materialization of Future without any hangs.

**Minimal Complete Verifiable Example**:

```python
if __name__ == "__main__":
from distributed.client import Client

c = Client()

def remote_func(wrapped_future):
print(f'Wrapped_future: {wrapped_future}')

# Hangs
print(f'Wrapped_future.get: {wrapped_future.get()}')
return 0

class FutureWrapper:
def __init__(self, obj_future):
self.obj_future = obj_future

def get(self):
return self.obj_future.result()

class Worker:
def __init__(self):
self.some_info = 1

def task(self):
complex_obj = FutureWrapper(c.scatter(lambda x: x, hash=False))
# complex_obj = FutureWrapper(c.scatter(0, hash=False))
future_res = c.submit(remote_func, complex_obj, pure=False)
return future_res

worker = Worker()
future_res = worker.task()
result = future_res.result()
print(f'Result: {res}')

```

**Anything else we need to know?**:

**Environment**:

- Dask version: 2.19.0
- Python version: 3.8.8
- Operating System: Ubuntu 20.04
- Install method (conda, pip, source): pip

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.