Accumulate without emit/output

Đang mở
#417 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
stream-processing

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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?

Ngôn ngữ chính
Python
Star
1.3k
Fork
149
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của python-streamz/streamz

Tất cả issue của python-streamz/streamz

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.