blob: 33b51b2b853820cb959dfe226e3df0cfeb0f7a94 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# Rivulet
Elegant asynchronous data streams
```python
from rivulet import BatchProcessor
async def item_stream():
for i in range(10):
yield i
await asyncio.sleep(0.1)
async def main():
processor = BatchProcessor(batch_size=3, timeout_seconds=0.5)
async for batch in processor.process(item_stream()):
print(f"Processing batch of {len(batch)} items: {batch}")
```
|