Accumulate without emit/output

オープン
#417 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python

調査の方向性

Start with the linked Accumulating State documentation and the accumulate and partition APIs. Reproduce the example using returns_state=True and a conditional emission, then determine whether accumulate supports suppressing output directly. Done means the requested behavior is implemented or the documentation clearly explains the supported approach, with coverage for both emitted and suppressed values.

索引モデルが issue の本文から書いたものです。

説明

According to the documentation of accumulate (Accumulating State), it is possible to not have accumulate "output" anything:

One piece of data comes in, either one or zero pieces go out.

I tried to come up with a way to use this to "group" values together: collect values as they come in and emit a list "every now and then".

Basically I have something along the lines of this now:

stream = streamz.Stream()
grouped = stream.accumulate(my_group, returns_state=True, start={}).filter(non_empty)


def my_group(state, row):
    ...
    if <condition>:
        return state, [<collected_rows>]
    else:
        return state, None

def non_empty(row):
    if row:
        return True
    return False

But I think the .filter(non_empty) part should not be necessary. I should be able to not return (output) a value unless I emit a list in my_group, no? Would that not be the "zero pieces go out" case?

Note: I realised in the meantime that I might be able to achieve what I need using partition, but the question remains (for other use cases): how can I not emit (or output) a value from accumulate?

主要言語
Python
スター
1.3k
フォーク
149
PR マージ指標
30日以内にマージされた PR はありません

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

python-streamz/streamz のほかの issue

python-streamz/streamz の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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