faust icon indicating copy to clipboard operation
faust copied to clipboard

"Monitor lost event in state for ..." warning when using Stream.take

Open jsundh opened this issue 7 years ago • 4 comments

Checklist

  • [x] I have included information about relevant versions
  • [ ] I have verified that the issue persists when using the master branch of Faust.

Steps to reproduce

Use Stream.take on a simple stream:

#!/usr/bin/env python
import faust

app = faust.App("take-bug", broker="kafka://localhost:9092")

topic = app.topic("take-bug", value_type=int)


@app.agent(topic)
async def print_sum(stream):
    async for batch in stream.take(5, within=10):
        print(sum(batch))


@app.timer(5)
async def produce():
    for i in range(100):
        await print_sum.send(value=i)


if __name__ == "__main__":
    app.main()

The take method calls Stream.ack, which does not seem to have the sensor_state variable that __aiter__ has.

Expected behavior

Monitoring/event callbacks working without warnings.

Actual behavior

A warning about "Monitor lost event in state" for each message:

[2019-05-15 13:58:14,735: WARNING]: 10
[2019-05-15 13:58:14,736: WARNING]: [^--Monitor]: Monitor lost event in state for TopicPartition(topic='take-bug', partition=0):0
[2019-05-15 13:58:14,737: WARNING]: [^--Monitor]: Monitor lost event in state for TopicPartition(topic='take-bug', partition=0):1
[2019-05-15 13:58:14,738: WARNING]: [^--Monitor]: Monitor lost event in state for TopicPartition(topic='take-bug', partition=0):2
[2019-05-15 13:58:14,738: WARNING]: [^--Monitor]: Monitor lost event in state for TopicPartition(topic='take-bug', partition=0):3
[2019-05-15 13:58:14,739: WARNING]: [^--Monitor]: Monitor lost event in state for TopicPartition(topic='take-bug', partition=0):4
[2019-05-15 13:58:14,740: WARNING]: 35
[2019-05-15 13:58:14,741: WARNING]: [^--Monitor]: Monitor lost event in state for TopicPartition(topic='take-bug', partition=0):5
[2019-05-15 13:58:14,741: WARNING]: [^--Monitor]: Monitor lost event in state for TopicPartition(topic='take-bug', partition=0):6
[2019-05-15 13:58:14,741: WARNING]: [^--Monitor]: Monitor lost event in state for TopicPartition(topic='take-bug', partition=0):7
[2019-05-15 13:58:14,742: WARNING]: [^--Monitor]: Monitor lost event in state for TopicPartition(topic='take-bug', partition=0):8
[2019-05-15 13:58:14,742: WARNING]: [^--Monitor]: Monitor lost event in state for TopicPartition(topic='take-bug', partition=0):9
[2019-05-15 13:58:14,743: WARNING]: 60

Versions

  • Python version: 3.7.3
  • Faust version: 1.6.1
  • Operating system: Ubuntu 18.04
  • Kafka version: 1.1
  • RocksDB version (if applicable): N/A

jsundh avatar May 15 '19 13:05 jsundh

Yep, the sensors are not executing when using stream.take. The warning was added as I thought this would not happen, but makes sense in this case that the on_stream_event_in handler is not called for the event.

So we should just remove the warning

ask avatar May 24 '19 22:05 ask

Ok. So if I understand correctly, that means Monitor is not fully supported when using stream.take?

jsundh avatar May 28 '19 06:05 jsundh

Yeah, the monitor is not accounting for individual events when using stream.take. I'm not sure it makes sense to do so either.

ask avatar Jun 20 '19 18:06 ask

Warning is removed in 1.7

ask avatar Jun 20 '19 18:06 ask