Skip to content

[ENH]: add orchestrator to construct version graph for garbage collection #4463

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

Merged
merged 1 commit into from
May 23, 2025

Conversation

codetheweb
Copy link
Contributor

@codetheweb codetheweb commented May 6, 2025

Description of changes

Adds an orchestrator to construct the version graph for all collections in a fork tree to be used by garbage collection.

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Added tests for new orchestrator.

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs section?

n/a

Copy link

github-actions bot commented May 6, 2025

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

if tracing::level_enabled!(tracing::Level::DEBUG) {
let dot_viz = Dot::with_config(&self.graph, &[]);
let encoded = BASE64_STANDARD.encode(format!("{:?}", dot_viz));
tracing::debug!(base64_encoded_dot_graph = ?encoded, "Constructed graph.");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

logged graph repr can be pasted into any graphviz-compatible viewer for debugging (e.g. https://graph.flyte.org)

@codetheweb codetheweb force-pushed the feat-sysdb-batch-get-version-file-paths-method branch 2 times, most recently from 0d136b9 to 6ad39d0 Compare May 13, 2025 17:35
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from 2d8c1b7 to fafe998 Compare May 13, 2025 17:35
Copy link
Contributor

propel-code-bot bot commented May 13, 2025

Add Orchestrator for Building Collection Version Graphs for GC

This PR introduces a new orchestrator (ConstructVersionGraphOrchestrator) for constructing a version dependency graph across all collections in a fork tree, to support garbage collection workflows. Supporting Rust operators to fetch lineage files, fetch version files, and batch-fetch version file paths are added and integrated, alongside updates to relevant orchestrator logic and supporting changes to the garbage collector pipeline, storage API, and dependencies. Extensive test coverage for the graph construction is included, validating both simple and complex collection/version lineage cases.

Key Changes:
• Added rust/garbage_collector/src/construct_version_graph_orchestrator.rs, implementing the version graph orchestrator.
• Introduced FetchLineageFileOperator, FetchVersionFileOperator (refactored), and GetVersionFilePathsOperator, each with input/output structs and error handling.
• Updated orchestrator wiring to fetch and use lineage files and version file paths for graph construction.
• Altered FetchVersionFileOutput to return parsed CollectionVersionFile objects (not just raw bytes).
• Integrations and minor refactoring in garbage_collector_orchestrator.rs and storage/lib.rs for new interfaces.
• Augmented Cargo manifests with petgraph and base64 dependencies for graph construction and debugging.
• Implemented comprehensive tests for constructing version graphs covering simple and forked histories.

Affected Areas:
• Rust garbage_collector orchestrator logic
• Rust operators for storage/sysdb fetching
• Rust storage interface
• Graph construction, lineage and version file management
• Cargo.toml, Cargo.lock (dependency management)

Potential Impact:

Functionality: Enables garbage collection logic to operate on entire version/fork trees rather than a single collection. Improves ability to trace dependencies and perform accurate collection/variant cleanup.

Performance: Slight increase in orchestrator complexity; batched fetching of version files may help performance. Additional in-memory graph processing is limited by number of collections in a fork.

Security: No new security risks introduced; new code inherits data access/authorization from existing storage and sysdb layers.

Scalability: Graph-based approach scales to arbitrary fork trees; performance may need tuning for very large trees but core approach is scalable.

Review Focus:
• Correctness of graph assembly logic and edge construction in ConstructVersionGraphOrchestrator.
• Error and edge case handling, especially with missing lineage/version files.
• Operator input/output API clarity and error management.
• Pre-existing orchestrator integrations after storage API changes.
• Test coverage adequacy and edge case completeness.

Testing Needed

• Run all garbage_collector unit/integration tests (including newly added tests for version graphs).
• Test garbage collection on collections with simple and complex ancestry (with/without lineages, forks, joins).
• Check graph serialization/debugging output for correctness and usability.
• Smoke test operator error conditions (missing files, sysdb errors, unexpected node splits, etc).

Code Quality Assessment

rust/garbage_collector/src/operators/get_version_file_paths.rs: Simple, direct batch fetching and error propagation.

rust/garbage_collector/src/garbage_collector_orchestrator.rs: Updated to match new FetchVersionFileOutput interface; residual commented-out code was removed.

rust/storage/src/lib.rs: Added Debug implementation for Storage; otherwise minimal change.

Cargo files: Dependency updates are precise and necessary for new features.

rust/garbage_collector/src/construct_version_graph_orchestrator.rs: Well-structured; uses async patterns, clear error enums, and trait-based orchestrator integration. Large, so future decomposition may help maintainability.

rust/garbage_collector/src/operators/fetch_version_file.rs: Refactored for new output types; improved error reporting. Debug implementations and API patterns follow Rust conventions.

rust/garbage_collector/src/operators/fetch_lineage_file.rs: Clean, idiomatic, covers code and decode paths. Good use of error enums.

Best Practices

Dependency Management:
• Cargo additions scoped to new features

Documentation:
• Rustdoc, struct and method comments present; some areas could be further documented (e.g. on graph invariants)

Error Handling:
• Extensive error enums and propagation
• Clear conversion between operator/task/orchestrator errors

Code Modularity:
• New operators isolated per responsibility
• Separation of orchestrator and execution logic

Testing:
• Broad, scenario-driven, and edge-case-heavy tests, including graph assertions

Potential Issues

• If collection or version lineage is partially missing, logic may terminate with error or skip nodes; correctness under partial data should be monitored.
• Performance for very large version graphs could be constrained by in-memory graph construction.
• Care should be taken if extending the graph types (e.g., status fields) to ensure consistency.

This summary was automatically generated by @propel-code-bot

@codetheweb codetheweb force-pushed the feat-sysdb-batch-get-version-file-paths-method branch from 6ad39d0 to 93be17d Compare May 15, 2025 16:52
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from fafe998 to ef973c9 Compare May 15, 2025 16:52
@codetheweb codetheweb force-pushed the feat-sysdb-batch-get-version-file-paths-method branch from 93be17d to ea366a5 Compare May 15, 2025 20:11
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from ef973c9 to bdc98f5 Compare May 15, 2025 20:11
@codetheweb codetheweb force-pushed the feat-sysdb-batch-get-version-file-paths-method branch from ea366a5 to edf6743 Compare May 15, 2025 22:38
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from bdc98f5 to 8137f4d Compare May 15, 2025 22:38
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from 8137f4d to 14eb5e7 Compare May 15, 2025 22:43
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from 6e6f97f to d62f117 Compare May 19, 2025 23:38
@codetheweb codetheweb force-pushed the feat-sysdb-batch-get-version-file-paths-method branch from 5801be6 to 90ac80a Compare May 19, 2025 23:45
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from d62f117 to cb3e44a Compare May 19, 2025 23:45
@codetheweb codetheweb force-pushed the feat-sysdb-batch-get-version-file-paths-method branch from 90ac80a to 2e26e8a Compare May 20, 2025 18:02
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from cb3e44a to 1242760 Compare May 20, 2025 18:02
@codetheweb codetheweb force-pushed the feat-sysdb-batch-get-version-file-paths-method branch 2 times, most recently from 7344e5c to c3a7502 Compare May 20, 2025 18:42
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from 1242760 to 1a374a3 Compare May 20, 2025 18:42
@codetheweb codetheweb force-pushed the feat-sysdb-batch-get-version-file-paths-method branch from c3a7502 to 2425e04 Compare May 20, 2025 19:41
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from 1a374a3 to f4a6ed4 Compare May 20, 2025 19:42
@codetheweb codetheweb force-pushed the feat-sysdb-batch-get-version-file-paths-method branch from 2425e04 to a09392f Compare May 21, 2025 16:45
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from f4a6ed4 to cdff65d Compare May 21, 2025 16:45
let output = match self.ok_or_terminate(message.into_inner(), ctx).await {
Some(output) => output,
None => {
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should also tracing::error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok_or_terminate() will log any error

@codetheweb codetheweb force-pushed the feat-sysdb-batch-get-version-file-paths-method branch from a09392f to 1af74ec Compare May 22, 2025 23:23
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from cdff65d to 3ec6e51 Compare May 22, 2025 23:23
@codetheweb codetheweb changed the base branch from feat-sysdb-batch-get-version-file-paths-method to graphite-base/4463 May 22, 2025 23:57
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from 3ec6e51 to 797d3f7 Compare May 22, 2025 23:58
@codetheweb codetheweb force-pushed the graphite-base/4463 branch from 1af74ec to 2f4ce46 Compare May 22, 2025 23:58
@graphite-app graphite-app bot changed the base branch from graphite-base/4463 to main May 22, 2025 23:58
@codetheweb codetheweb force-pushed the feat-gc-construct-version-graph branch from 797d3f7 to 7591c20 Compare May 22, 2025 23:58
@codetheweb codetheweb merged commit 38742ab into main May 23, 2025
72 checks passed
Copy link
Contributor Author

Merge activity

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