Simple example of stream with Asyncio operations
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
Start by reproducing the Python example from the issue with its aiohttp, asyncio, and Stream(asynchronous=True) pipeline. Read the streamz asyncio-related implementation and existing tests, if present, to determine whether async map operations are supported. Done means the reported pipeline runs correctly or the supported limitation is documented.
索引モデルが issue の本文から書いたものです。
説明
Hi,
I've been following the docs and reading through the tests, and I cannot get streamz working with Asyncio :/
Here's a very minimal example of a stream comprising of two async operation and one sync :
- we retrieve content via an aiohttp call
- return content length
- simulate DB write with an Asyncio sleep
- sink to stdout
import asyncio
import aiohttp
from streamz import Stream
async def fetch(url):
print("fetching url {}", url)
async with aiohttp.ClientSession() as session:
async with session.get(url) as resp:
print(resp.status)
body = await resp.text()
print("Finished w/ url {}", url)
return body
def count(x):
print("I", x)
return len(x)
async def write(x):
await asyncio.sleep(0.2)
print("O", x)
return x
async def f():
print("Starting stream")
source = Stream(asynchronous=True)
source.map(fetch).map(count).map(write).sink(print)
urls = [
'https://httpstatus.io/?i=1',
'https://httpstatus.io/?i=2',
'https://httpstatus.io/?i=3',
'https://httpstatus.io/?i=4',
'https://httpstatus.io/?i=5',
'https://httpstatus.io/?i=6',
]
for u in urls:
await source.emit(u)
if __name__ == '__main__':
asyncio.run(f())
I've tried a lot of combinations using tornado event loop etc. but didn't manage to get anything working.
Is this supposed to be possible or is the Asyncio support still behind?
Am I missing something obvious?
Thanks for the help
- 主要言語
- Python
- スター
- 1.3k
- フォーク
- 149
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python-streamz/streamz のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
python-streamz/streamz#481 · コメント 4 件 ·
-
Combining the streamz.Stream.filenames() and streamz.Stream.from_textfile() using dask scatter? オープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
python-streamz/streamz#480 · コメント 2 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
python-streamz/streamz#479 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
python-streamz/streamz#478 · コメント 6 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 10/100
python-streamz/streamz#476 · コメント 17 件 · リアクション 2 件 ·
python-streamz/streamz の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main オープンarea: ci bug perceived difficulty: 3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ClickHouse/clickhouse-connect#1057 ·