Writing into Table with Stream.take() not allowed
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 18/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- stream-processing
Direzione di ricerca
The error is raised in partition_for_key in faust/tables/base.py, reached from on_key_set in faust/tables/table.py when a table key is set inside an agent. Run the reproduction from the issue against a local Kafka and read how the stream context is tracked around stream.take(). Done means either the write succeeds inside take() or the maintainers document the intended pattern. The thread is old and the approach is undecided, so confirm direction before coding.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Steps to reproduce
When using the Stream.take() function I can not write into a Table but get the error Cannot modify table key from outside of stream iteration.
Can I just not write to tables when using take?
Example:
from faust import App
app = App(id="take-error-example")
topic = app.topic('orders')
table = app.Table('orders')
@app.agent(topic)
async def consumer(stream):
async for values in stream.take(1):
for value in values:
table["key"] = "some value"
yield value
Expected behavior
The key value pair should be written into the Table
Actual behavior
File ".../python3.10/site-packages/mode/utils/collections.py", line 652, in __setitem__
self.on_key_set(key, value)
File ".../python3.10/site-packages/faust/tables/table.py", line 77, in on_key_set
fut = self.send_changelog(self.partition_for_key(key), key, value)
File ".../python3.10/site-packages/faust/tables/base.py", line 314, in partition_for_key
raise TypeError(
TypeError: Cannot modify table key from outside of stream iteration
Versions
- Python version: 3.10.6
- Faust version: 0.10.11
- Operating system: MacOS 13
- Lingua principale
- Python
- Stelle
- 1.9k
- Fork
- 205
- Merge medio
- 2h 2m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di faust-streaming/faust
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
faust-streaming/faust#804 ·
-
scripts/install script forces use of ./venv virtualenv, impossible to use with virtualenvwrapperAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
faust-streaming/faust#28 · 1 commento ·
-
[BUG] SASL PLAINTEXT producer initialization fails : missing sasl_plain_username/passwordForse già presa @wbarnha l’ha presa 56 giorni fa. Aperta
faust-streaming/faust#794 · 2 commenti · 1 reazione · 2 assegnatari ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 18/100
faust-streaming/faust#670 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 18/100
faust-streaming/faust#666 ·
Tutte le issue di faust-streaming/faust
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
[Maintainer] task area:visualizer
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
RailtownAI/railtracks#1824 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
apache/datafusion#27688 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
heasarc/heasarc-tutorials#317 ·
-
bug good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
mloda-ai/mloda-registry#1664 ·
I maintainer di solito rispondono entro 1 giorno