feat(core): add document resource type - #1127
Conversation
for storing text documents related to resources
|
From just the description, I wonder whether this design will lead to more of the same problems that we already have for Datacontainers. As it stands, Datacontainers store their content in the resources table and can be very large (we have examples of datacontainers from sft-trainer which exceed 18MB), ballooning the whole table up and slowing down retrieval. In general, as well, storing byte-like objects in a stringified format in a JSON/text column seems like an antipattern. I would think about only storing references to BLOBs and having a dedicated table for those. Later on in the future we could also take advantage of it to slim down datacontainers |
|
@AlessandroPomponio We could simplify this and remove the attachments functionality for initial implementation. Add it back later if needed/when we decided how to store the attachments (i.e. link instead of raw data, where the raw data goes). |
|
Sounds good! |
Can re-add separately, possible by different mechanism
AlessandroPomponio
left a comment
There was a problem hiding this comment.
The PR description says this is also meant for HTML reports. If we keep it to markdown only, though, we could also have a describe command that uses rich's Markdown renderer to render and print the document to the terminal.
This PR is also missing updating the ado cli reference doc
Yes I did think of this and it was originally markdown. However then Daniele or Vassilis was showing me that bob was creating HTML reports with graphical elements and I thought we should store them. I mean we could have it also id html and describe open a brokers. It would be good to have the describe for markdown in any case as reading the reports as human is not easy as is. |
For discriminating markdown and html content
For discriminating markdown and html content
outputs markdown as rich objects if output stream is terminal, otherwise writes content field to pipe/file. if html and directed to terminal the content is written to file and then browser opened.
|
If implemented describe for markdown and html, also discriminating behaviour between tty and no tty |
Needs a different solution
is_terminal is not accurate enough for identify non-terminal output. In particular if certain rich envvars e.g. FORCE_COLOR are set it will report True even if output is redirected.
|
So this the next steps
|
|
@AlessandroPomponio latest version is ready |
This PR adds a new resource type, document, for storing markdown or html docs that describe spaces, operations or combinations thereof.
Create with
ado create document -f DOCUMENT.YAML. Read withado get document $RESOURCEID. A document can have multiple related resources. It's not required that it has any - for example a document containing a report about the entire project at a point in time should not have to list every single space and operation, and there is no "project" resource.Example document yaml
The
relatedResourcesis a list of dictionaries. The dicts have to keysado describe documentwill#925