You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To/from "state" helpers for tmt state files (#4486)
tmt saves its state info - step data, test data, guest data, etc. - in
YAML format, plent yof `*.yaml` files in a workdir. It's fine, it's
readable by both machines and humans, it works.
It turns out YAML is not necessarily the best format out there, as YAML
can be costly to generate when dealing with large structures and large
collections.
Two things happen in this PR:
* To allow some experimentation, `TMT_STATE_FORMAT` environment variable
tells tmt which format to use when storing its data. As of now, only
`yaml` is supported.
* "to/from JSON" helpers are refactored to align with recent changes to
"to/from YAML" helpers, to provide similar function names, annotations
and so on, and they are made available for selection via
`TMT_STATE_FORMAT`, making JSON the second supported format for tmt
state files.
Moar formats, moar fun!
A set of simple helpers, `to_state` and `from_state` is defined, based
on the aforementioned envvar, and patch changes all places where tmt
stores state on disk to use them instead of `{to,from}_yaml`.
`Common.{read,write}_state()` will help with that, instead of
`Common.{read,write}()` methods.
Now we can play with different format, and even if we learn the format
is not the culprit of ineffective storage of large collections of
results, we will have nice and tidy internal API to work with.
0 commit comments