dask / dask/distributed

Dask coroutines

オープン
#1,663 コメント 11 件 リアクション 2 件 担当者 0 名 GitHub で見る
discussion enhancement
主要言語
Python
スター
1.7k
フォーク
778
平均マージ
2時間 50分
マージ済み PR(30日)
3

説明

There are currently a few ways to construct highly dynamic workloads, where the graph can change during computation. This includes operations like `get_client()`, calling `dask.compute` within a task, using futures and `as_completed`, and so on.

Sometimes these workloads can grow complex and difficult to reason about (see https://github.com/dask/distributed/issues/1424). Are there better programming interfaces to present to users that still cover the same options, but perhaps guide users to correct behavior.

Asynchronous projects like Tornado/Asyncio/Curio/Trio seem to prefer a coroutine-style approach. Is this a possible option for a distributed runtime like Dask? If so what would it look like?

Here are a couple of toy problems that come up frequently and naive thoughts on how they might look as coroutines

### Fibonacci

```python
@dask.coroutine
def fib(i):
if i < 2:
return i
else:
a, b = yield [fib(i - 1), fib(i - 2)]
return a + b
```

### Evaluating on a remote list of unknown size

```python
@dask.coroutine
def generate_data():
return list(range(random.randint(0, 10))) # a list of data of unknown length

@dask.coroutine
def inc(x):
return x + 1

@dask.coroutine
def my_len(L):
return len(L)

@dask.coroutine
def my_sum(L):
return sum(L)

@dask.coroutine
def process_all():
L = generate_data()
n = yield my_len(L)
processed = [inc(L[i]) for i in range(n)]
total = yield sum(processed)
return total
```

There are problems with both examples. They also don't represent the full space of complexity that existing solutions can cover. Broad thoughts on this topic are welcome.

cc @ogrisel @pitrou @remram44 @adamklein

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。