Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POC: Early Exit 1 - app.run(number, timeout) #723

Closed
wants to merge 4 commits into from
Closed

Conversation

gwaramadze
Copy link
Contributor

@gwaramadze gwaramadze commented Jan 22, 2025

Introduces an ability to collect a small batch of data and inspect interactively in a Python interpreter or a tool like Jupyter Notebook.

  1. Adds ExitManager, an internal class that facilitates stopping the Application once a certain number of messages has been processed or a timeout in seconds is reached.
  2. Adds LocalSink, an in-memory container to store a batch of messages. After an application is stopped, data stored in the sink may be interactively used as a list or Pandas/Polars dataframe.

How to use?

from uuid import uuid4

from quixstreams import Application
from quixstreams.sinks.core.local import LocalSink

app = Application(broker_address="localhost:19092")

topic = app.topic("some-topic")
sink = LocalSink()  # or LocalSink(metadata=True)
sdf = app.dataframe(topic=topic).sink(sink)

app.run(number=10, timeout=3)

# app runs and stops

sink.list
sink.pandas
sink.polars

Results without metadata:
image

Results with metadata:
image

This reverts commit c68503e.
ExistManager is responsible for stopping the application once
a certain number of messages arrives or a timeout is reached.
@gwaramadze gwaramadze changed the title POC: Inspect POC: Debugging Jan 27, 2025
@gwaramadze gwaramadze changed the title POC: Debugging POC: Early Exit Jan 28, 2025
@gwaramadze gwaramadze changed the title POC: Early Exit POC: Early Exit 1 Jan 29, 2025
@gwaramadze gwaramadze changed the title POC: Early Exit 1 POC: Early Exit 1 - app.run(number, timeout) Jan 29, 2025
@gwaramadze gwaramadze closed this Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant