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

Add C and Python API for LDMS Schema info access #1448

Open
wants to merge 3 commits into
base: OVIS-4
Choose a base branch
from

Conversation

narategithub
Copy link
Collaborator

This is to support information access to LDMS Schema and Record
Definition objects without the LDMS sets. The schema registry needs
these APIs to access metric information inside the Schema and Record
Definition to construct their representation in the Schema Registry
database.

This pull request also includes bug fixes found along the way.

`BYTES()` converted `str`, or `object` into `bytes` which can later
converted to `char *` by Cython. However, `BYTES(None)` got converted to
`b'None'`, which is unintended. What we wanted in `ldms.pyx` is to
convert `None` as NULL. In order to do so, we need `CSTR()` to convert
`bytes` or `None` into `char *` or `NULL` respectively. We cannot
convert `object` into `char *` or `NULL` in one go in `CSTR` because the
first `bytes` conversion would be an object that temporarily lives in
the `CSTR()` function and the `<char*>` conversion on that temporary
object will be an invalid pointer.

This patch also add `CBYTES(c_str)` that returns `None` when `c_str` is
`NULL`. We need this because `char *` is automatically converted to
`bytes` automatically by Cython when it is assigned to a Python
variable, but the program crashes when the pointer is NULL (due to the
subsequent invalid `PyBytes_FromString(NULL)` call).
…emplate()`

For `LDMS_V_RECORD_TYPE`, `rec_def->flags` is used and the `ent->flags`
is actually ignored. Hence, we should not check `ent->flags` and yeild
an error because of it.
This is to support information access to LDMS Schema and Record
Definition objects without the LDMS sets. The schema registry needs
these APIs to access metric information inside the Schema and Record
Definition to construct their representation in the Schema Registry
database.
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