-
Notifications
You must be signed in to change notification settings - Fork 14
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
Python bindings #426
Python bindings #426
Commits on Oct 21, 2024
-
events: do not derive Default on event sections
It is not required by the core or by any other piece of infrastructure. Only some events need to derive from Default because of the way they are constructed. Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a9aa217 - Browse repository at this point
Copy the full SHA a9aa217View commit details -
events: ovs: Use Option instead of unit enum value.
OVS module currently makes no assumptions on the order of the event chunks and tries to build the event even if out-of-order pieces are received. This makes little sense in practice as these chuncks are sent in the same hook. Removing that unneeded requirement and assuming the base action event (OVS_DP_ACTION) will be received before specific action argument events (e.g: OVS_DP_ACTION_OUTPUT) makes decoding simpler. This also it avoids requiring a Default version of the event which is currently implemented using an "undefined" value for enums. This mechanism is not supported by pyo3. Also, create a dummy object to avoid having mixed complex unit variants in enums. [1] Upstream discussions: PyO3/pyo3#3582 (comment) PyO3/pyo3#3749 Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ba01022 - Browse repository at this point
Copy the full SHA ba01022View commit details -
events: move TestEvent to event crate.
It is useful to be able to define a dummy event to test their creation (factories) and manipulation. However, in preparation to add python support, we must ensure pyo3 dependencies only come from retis-events. Therefore, all events must be defined there, including TestEvent. Create a feature to enable this dummy event that is enabled only when "cargo test" is run on the main crate. Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ce8cef4 - Browse repository at this point
Copy the full SHA ce8cef4View commit details -
events: move EventSeries to events crate.
Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for cb81d64 - Browse repository at this point
Copy the full SHA cb81d64View commit details -
events: make events implement Send
Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 42086d2 - Browse repository at this point
Copy the full SHA 42086d2View commit details -
helpers: bimap: explicitly name the lifetime
It would anyway be resolved to 'a and nightly toolchain prefers it to be explicit. Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 417373c - Browse repository at this point
Copy the full SHA 417373cView commit details -
events: simplify EventFactory API.
It currently uses a struct EventResult that was originally thought to be used when creating events from ebpf as it has a timeout. The file factory is not using this so we can express the result as Result<Option<Event>>. Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 0174e46 - Browse repository at this point
Copy the full SHA 0174e46View commit details -
python: add python event representation.
Use pyo3 to represent events and event sections. Notably, this requires some simple enums to implement PartialEq. Also, SectionId::from_str() has to be recovered. EventTypes are given a __repr__() helper that uses the debug formatter. It seems a good first start. EventSections are given a __repr__() helper that prints a dictionary based on the json object as well as a show() helper that formats the event. Co-authored-by: Adrian Moreno <[email protected]> Signed-off-by: Antoine Tenart <[email protected]> Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9e0038e - Browse repository at this point
Copy the full SHA 9e0038eView commit details -
events: add interactive python shell
Add an python shell as post-process command. Signed-off-by: Antoine Tenart <[email protected]> Co-authored-by: Antoine Tenart <[email protected]> Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for c851aef - Browse repository at this point
Copy the full SHA c851aefView commit details -
Add a helper to iterate through the available sections of an event. Expose such helper to the python representation. Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3395af4 - Browse repository at this point
Copy the full SHA 3395af4View commit details -
events: support Series in FileEventFactory
Currently, EventSeries are created, printed and even encoded into json but we do not support reading it back from json. This patch adds support for EventSeries in FileEventFactory. The type of file that is being processed is autodetected upon creation and a differnt interface (next_series()) is used to retrieve EventSeries so that typing is clear. By also adding TrackingInfo to the types that unmarshal, we can now do: ``` retis collect [...] retis sort -o sorted.json retis print sorted.json ``` Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e478159 - Browse repository at this point
Copy the full SHA e478159View commit details
Commits on Oct 24, 2024
-
retis-events: introduce python library.
The features used for pyo3 are different (and not-compatible) for the embedded interpreter and python bindings, so move the interpreter into an independent file that is easy to conditionally compile off. Use maturin to build with stable abi3. Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 33985cf - Browse repository at this point
Copy the full SHA 33985cfView commit details -
ci: add a cirrus task to build python bindings
Store the result as artifact to ease testing. Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 484f634 - Browse repository at this point
Copy the full SHA 484f634View commit details -
docs: Document python bindings
Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for ef9946f - Browse repository at this point
Copy the full SHA ef9946fView commit details -
events: add python library tests
Use tox to handle virtual env and pytest to as test runner. Add a task in cirrus CI to run them. Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 574ac76 - Browse repository at this point
Copy the full SHA 574ac76View commit details -
Cargo.toml: make python optional but default.
Python support provided by pyo3 requires linking against python >= 3.6. Building retis on distros with older python versions would fail. In order to work around this issues, make python an optional dependency but enable it by default. On non-supported distros, CARGO_CMD_OPTS="--no-default-features" can be used to build without python support. Signed-off-by: Adrian Moreno <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b4f20e0 - Browse repository at this point
Copy the full SHA b4f20e0View commit details