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

Support some degree of live python scripting #454

Open
amorenoz opened this issue Nov 28, 2024 · 3 comments
Open

Support some degree of live python scripting #454

amorenoz opened this issue Nov 28, 2024 · 3 comments

Comments

@amorenoz
Copy link
Contributor

After chatting with @igsilya and others at OVS/OVN Conference, some feedback we got is:
1 - It'd be nice to be able to run python scripts at collect time
2 - It'b be nice to be able to ease the execution of python scripts by just using UNIX pipes

Doing 1 by embedding the python executor in the collect main loop (which runs to completion) can introduce latency that may lead to increased event loss. So we'd need to split "printing/processing" and collection into different threads.

However, 2 actually makes it possible to do 1 easier by making collect and python two different processes, "just" paying the cost of {,un}marshaling events with minimal changes to the core event loop. Let's imagine we could:

retis collect [...] --format json | retis python myscript.py
@igsilya
Copy link

igsilya commented Nov 28, 2024

Hmm. Is there a real difference though in terms of potential for event dropping? The pipe writes are blocking once the buffer is filled up. And if you make them non-blocking then you'll still drop events, unless they are buffered somewhere else.

@amorenoz
Copy link
Contributor Author

Having multi-threaded loop to avoid blocking on I/O is something that we'll need to tackle eventually but it's probably a relatively big work. This problem exists today as well, of course, whether it's writing to terminal, file or both, it can delay event processing.

Embedding the python interpreter in the event processing loop adds a potentially unbound delay with no buffering unless we implement it internally. Using a pipe gives us a buffer and parallel event processing "for free" with minimal changes in retis.

I'm not saying we won't embed the python interpreter in the event loop, we've wanted to add custom event formatting for some time, but right now enabling piping is a very cheap way making this "work". Note "some degree of" in the title :-)

@westurner
Copy link

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

No branches or pull requests

3 participants