-
Notifications
You must be signed in to change notification settings - Fork 60
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
Store the model definition into files that are written #358
Conversation
8ec13fa
to
56d1149
Compare
Moved some of the general refactoring / code cleanup into #363 to make this diff slightly less cluttered (once it is merged). |
56d1149
to
4ee44ff
Compare
4ee44ff
to
ddb374c
Compare
ddb374c
to
eb85b5e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tmadlener - thanks for this great implementation.
There are a few things which need changing here. See my comments.
- Generate model definitions in JSON format as constexpr string literals - Register constexpr string literals in registry
- Also make the collections query-able
- Change order of main keys (options, components, datatypes) - Slightly tweak formatting (as far as possible with PyYAML)
eb85b5e
to
07f506a
Compare
Brief intermediate update: I have renamed the registry to |
@tmadlener - thanks for the updates - in particular as some of them were quite tedious... |
Alright, documentation is updated, and a final leftover header has also been renamed to match the new terminology. |
I think now I really have all the things that needed to be renamed ;) The two workflows that are currently failing, are due to failing upstream nightly builds (the |
all workflows are working again and passing |
@tmadlener - GREAT! :-) |
Is there anything still left to do on this one? I would open the issue for the missing correct handling of dependent datamodels once this is merged. I think I addressed the rest here. |
BEGINRELEASENOTES
DatamodelDefinition.h
header file containing the string literal json encoded definitionDatamodelRegistry
and make collections aware of which datamodel they belong toFrameWriter
spodio-dump
the necessary functionality to retrieve the stored models and dump them in YAML format againENDRELEASENOTES
This is a first, incomplete, draft of storing the model definition into the written files, such that they can be retrieved again later such that the datamodel(s) of the types stored in the file can be regenerated. This is mainly here to gather some early feedback before investing too much time into the whole thing. @hegner, @gaede, @andresailer please let me know if there are any serious concerns with the overall approach, details can then be hashed out later, I suppose.
The general idea is:
podio-dump
capable of) either generating the code directly from a file, or simply dumping the yaml definition again.The JSON string is a raw string literal that we simply generate via the code generator. In order to get this to the files, we also introduce a
DatamodelRegistry
singleton, where we make each datamodel statically register itself. While writing we simply query collections about which definition we need to write in the end, and we collect a list of all defintions that need writing, and write them once everything is done.The reason for JSON as storage "format" is because it yields relatively compact strings that need to be stored (especially compared to trying to store the raw YAML files). Additionally, converting between JSON and YAML in python is pretty trivial in the end (and only necessary if we want to dump a YAML file again).
TODO list:
DatamodelRegistry
singleton