Faust test hanging while puting data in agents
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 18/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- kafka, python
調査の方向性
The reproduction is in the issue body: three identical pytest tests that call process_test_flow.test_context() and agent.put() under asyncio.wait_for, with the fixture calling app.finalize() and app.flow_control.resume(). The report points at publish_message as where the hang occurs, so start there with the agent test-context and flow-control code. Done means the three tests pass together in one run against a local Kafka, with a regression test added. No one has commented or claimed the issue, so confirm the scope with maintainers first.
索引モデルが issue の本文から書いたものです。
説明
When testing, I get ome tests passing ok individually, but as soon as you run them together, the last one fails.
all tests are identical
The 3rd one will fail at some point to put.
I have no idea why, but it seems to happen during publish_message
Any idea why?
Pierre
env: python 3.12 on mac
import asyncio
import pytest
import faust
import os
# Purpose of this test class is only to demonstrate a full end to en test.
# No code used in real app will be present here
# Connect to the INTERNAL docker listener
BROKER_URL = os.getenv('KAFKA_BOOTSTRAP_SERVER', 'localhost:9092')
app = faust.App(
'test-sandbox-worker',
broker=f'kafka://{BROKER_URL}',
store='memory://',
autodiscover=True,
origin='tests' # Important so it finds this module
)
# --- Data Models ---
class MockEvent(faust.Record):
key: str
value: int
class MockResult(faust.Record):
key: str
total: int
# --- Topics ---
# Using specific test topics to avoid clashing with real data
input_topic = app.topic('test.sandbox.input', value_type=MockEvent)
output_topic = app.topic('test.sandbox.output', value_type=MockResult)
# --- State ---
test_table = app.Table('test_table', default=int)
# --- Agent ---
@app.agent(input_topic, sink=[output_topic])
async def process_test_flow(stream):
# Le group_by est important pour le partitionnement
async for event in stream.group_by(MockEvent.key):
# aggregation
test_table[event.key] += event.value
# generate result
yield MockResult(
key=event.key,
total=test_table[event.key]
)
@pytest.fixture(scope="function")
async def test_app():
app.loop = asyncio.get_running_loop()
app.finalize()
app.conf.store = 'memory://'
app.flow_control.resume()
return app
@pytest.mark.asyncio
async def test_aggregation_logic_native(test_app):
user_id = "user_123"
events = []
for i in range(50):
events.extend([
MockEvent(key=user_id, value=10),
MockEvent(key=user_id, value=20),
MockEvent(key=user_id, value=5),
])
async with process_test_flow.test_context() as agent:
for ev in events:
try:
await asyncio.wait_for(agent.put(ev), timeout=1.0)
except asyncio.TimeoutError:
pytest.fail(f"Agent hung while processing {ev}")
await asyncio.sleep(0.001)
@pytest.mark.asyncio
async def test_aggregation_logic_native_02(test_app):
user_id = "user_123"
events = []
for i in range(50):
events.extend([
MockEvent(key=user_id, value=10),
MockEvent(key=user_id, value=20),
MockEvent(key=user_id, value=5),
])
async with process_test_flow.test_context() as agent:
for ev in events:
try:
await asyncio.wait_for(agent.put(ev), timeout=1.0)
except asyncio.TimeoutError:
pytest.fail(f"Agent hung while processing {ev}")
await asyncio.sleep(0.001)
@pytest.mark.asyncio
async def test_aggregation_logic_native_03(test_app):
user_id = "user_123"
events = []
for i in range(50):
events.extend([
MockEvent(key=user_id, value=10),
MockEvent(key=user_id, value=20),
MockEvent(key=user_id, value=5),
])
async with process_test_flow.test_context() as agent:
for ev in events:
try:
await asyncio.wait_for(agent.put(ev), timeout=1.0)
except asyncio.TimeoutError:
pytest.fail(f"Agent hung while processing {ev}")
await asyncio.sleep(0.001)
- 主要言語
- Python
- スター
- 1.9k
- フォーク
- 205
- 平均マージ
- 2時間 2分
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
faust-streaming/faust のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
faust-streaming/faust#804 ·
-
scripts/install script forces use of ./venv virtualenv, impossible to use with virtualenvwrapperオープン
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
faust-streaming/faust#28 · コメント 1 件 ·
-
[BUG] SASL PLAINTEXT producer initialization fails : missing sasl_plain_username/password対応中かも @wbarnha が 56 日前に担当しました。 オープン
faust-streaming/faust#794 · コメント 2 件 · リアクション 1 件 · 担当者 2 名 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 18/100
faust-streaming/faust#666 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
faust-streaming/faust#656 ·
faust-streaming/faust の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
[Maintainer] task area:visualizer
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
RailtownAI/railtracks#1824 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
apache/datafusion#27688 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
heasarc/heasarc-tutorials#317 ·
-
bug good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
mloda-ai/mloda-registry#1664 ·
メンテナーはふだん 1 日以内に返信