Skip to content

Comments

Replace Graph.snapshot_id with new GraphSnapshot#336

Merged
JacobHayes merged 6 commits intogoldenfrom
add-graph-snapshot
Mar 17, 2023
Merged

Replace Graph.snapshot_id with new GraphSnapshot#336
JacobHayes merged 6 commits intogoldenfrom
add-graph-snapshot

Conversation

@JacobHayes
Copy link
Member

@JacobHayes JacobHayes commented Mar 16, 2023

Description

This replaces the optional Graph.snapshot_id field with a concrete GraphSnapshot class. This explicit separation makes it much more easily to reason about (and statically verify with mypy) that a section of code that requires a snapshot (eg: all Executor logic and most io) receives a snapshot, without littering a bunch of assert graph.snapshot_id is not None. This also makes tagging a bit more clear - you are tagging (and retrieving) a specific snapshot, so having an explicit entity is more clear.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

Added / updated tests and ran docs/examples/spend/demo.py.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in upstream modules

@JacobHayes
Copy link
Member Author

cc @JamesOswald

@codecov
Copy link

codecov bot commented Mar 16, 2023

Codecov Report

Merging #336 (a66ac76) into golden (fe744dd) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            golden      #336   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           43        43           
  Lines         2724      2734   +10     
  Branches       687       690    +3     
=========================================
+ Hits          2724      2734   +10     
Impacted Files Coverage Δ
src/arti/__init__.py 100.00% <100.00%> (ø)
src/arti/executors/__init__.py 100.00% <100.00%> (ø)
src/arti/executors/local.py 100.00% <100.00%> (ø)
src/arti/graphs/__init__.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Signed-off-by: Jacob Hayes <[email protected]>
Signed-off-by: Jacob Hayes <[email protected]>
Signed-off-by: Jacob Hayes <[email protected]>
Signed-off-by: Jacob Hayes <[email protected]>
@JacobHayes JacobHayes changed the title Add GraphSnapshot to handle Graph tagging and i/o Add GraphSnapshot to replace Graph.snapshot_id Mar 17, 2023
@JacobHayes JacobHayes changed the title Add GraphSnapshot to replace Graph.snapshot_id Replace Graph.snapshot_id with new GraphSnapshot Mar 17, 2023
@JacobHayes JacobHayes merged commit 45fd487 into golden Mar 17, 2023
@JacobHayes JacobHayes deleted the add-graph-snapshot branch March 17, 2023 04:21
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