Skip to content

Comments

Memory backend and serialization#39

Closed
joycex99 wants to merge 7 commits intogoldenfrom
backend
Closed

Memory backend and serialization#39
joycex99 wants to merge 7 commits intogoldenfrom
backend

Conversation

@joycex99
Copy link
Contributor

@joycex99 joycex99 commented May 2, 2021

Adds:

  • serialization and deserialization for Format, Storage, Type, Artifact, and Graph classes
  • an in-memory backend for persisting artifacts and graphs

One caveat is that the current Artifact reading/writing functionality depends on the schema, format, and storage being instance-level attributes rather than class-level, e.g. Artifact(schema=...).to_dict() and a = Artifact.from_dict({"schema": {...}}). Reading through the comments in the Artifact class again though, it looks like some of these aren't meant to be set by the instance.

@joycex99 joycex99 requested a review from JacobHayes May 2, 2021 01:31
@codecov
Copy link

codecov bot commented May 2, 2021

Codecov Report

Merging #39 (157b91b) into golden (3787f22) will decrease coverage by 4.70%.
The diff coverage is 79.01%.

Impacted file tree graph

@@             Coverage Diff             @@
##            golden      #39      +/-   ##
===========================================
- Coverage   100.00%   95.29%   -4.71%     
===========================================
  Files           15       15              
  Lines          567      723     +156     
  Branches        71       96      +25     
===========================================
+ Hits           567      689     +122     
- Misses           0       21      +21     
- Partials         0       13      +13     
Impacted Files Coverage Δ
src/arti/backends/core.py 74.35% <72.97%> (-25.65%) ⬇️
src/arti/types/core.py 89.01% <73.68%> (-10.99%) ⬇️
src/arti/graphs/core.py 87.75% <76.92%> (-12.25%) ⬇️
src/arti/formats/core.py 87.50% <80.00%> (-12.50%) ⬇️
src/arti/storage/core.py 88.88% <81.81%> (-11.12%) ⬇️
src/arti/artifacts/core.py 94.93% <89.47%> (-5.07%) ⬇️
src/arti/internal/utils.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3787f22...157b91b. Read the comment docs.

return Fingerprint.from_string(self.key or "")

@property
def id(self) -> int64:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference (in purpose) between id and key?

return f.key or int64(0)

def load(self, graph_id: int64) -> Graph:
if not self.backend:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I get that each graph belongs to a single backend, and a given backend can/should hold multiple graphs, but do we like this as a design choice? I.e., "a graph has a backend"? It feels like the more natural relationship is that a graph (or maybe I mean a "web of artifacts") can/should exist on its own during "declaration", and a backend is only necessary during either "read" or "write"?

@JacobHayes
Copy link
Member

Gonna close since things have significantly changed (particularly using pydantic to ease serialization), but we might be pulling bits out.

@JacobHayes JacobHayes closed this Sep 28, 2021
@JacobHayes JacobHayes deleted the backend branch September 28, 2021 16:55
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.

3 participants