-
Notifications
You must be signed in to change notification settings - Fork 6
MVP Pipeline Implementation with Utils update #99
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
Conversation
|
@guzman-raphael The code base is ready for a rough review, it is still missing tests and the list of todos above, but I plan to get it done by Wednesday night hopefully. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Cargo.toml
Outdated
| indexmap = { version = "2.9.0", features = ["serde"] } | ||
| # random name generator | ||
| names = "0.14.0" | ||
| petgraph = { version = "0.8.2", features = ["serde-1"] } |
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.
Before introducing petgraph serialization (assuming for storage), we should ensure it is deterministic.
e.g.:
graph TD;
A-->B;
A-->C;
and
graph TD;
A-->C;
A-->B;
should serialize the same in YAML. If not, we should defer until we can guarantee this.
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.
File an issue to properly fix this issue. At the moment it is none deterministic.
- TODO: Disable hash for now.
src/core/mod.rs
Outdated
| pub mod model; | ||
| pub(crate) mod orchestrator; | ||
| /// Components relating to pipelines | ||
| pub mod pipeline; |
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.
We should not public expose here. If meant to be public, it should be moved into within orcapod::uniffi::* with appropriate FFI exposure.
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.
Add TODO move it to uniffi side of the library, and add to derives to function and struct that we want to export.
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.
Added
src/uniffi/model.rs
Outdated
| /// # Errors | ||
| /// | ||
| /// Will return `Err` if there is an issue initializing a `Blob` instance. | ||
| pub const fn new(kind: BlobKind, location: URI) -> Self { |
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.
Why was this needed? Why not just: Blob {kind, location, ..Blob::default()}.
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.
Actually, very fair point, let me fix this.
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.
Pull Request Overview
This PR delivers an MVP implementation of pipeline construction from DOT notation, refactors utility helpers for generic use, and adds test fixtures to validate the new behavior.
- Introduce
Pipeline::from_dotand a uniquekernel_lutto prevent duplicate kernels - Generalize
getand addfind_missing_keysincore/utilfor input validation - Add end-to-end tests and fixtures for
PipelineandPipelineJob
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/pipeline.rs | Add basic tests for pipeline creation and specs |
| tests/fixture/mod.rs | Provide pipeline and pipeline_job fixtures |
| src/core/util.rs | Refactor get to generic key type and add find_missing_keys |
| src/uniffi/pipeline.rs | Implement Pipeline::from_dot, node hashing, and PipelineJob::new |
| src/uniffi/orchestrator/docker.rs | Minor update to JSON label lookup invocation |
Comments suppressed due to low confidence (3)
tests/fixture/mod.rs:226
- [nitpick] The fixture function name
pipelineshadows thePipelinetype and can be confusing. Consider renaming it tocreate_pipelineor similar.
pub fn pipeline() -> Result<Pipeline> {
tests/fixture/mod.rs:280
- [nitpick] This fixture
pipeline_jobcould be renamed tocreate_pipeline_jobto avoid ambiguity with thePipelineJobtype.
pub fn pipeline_job() -> Result<PipelineJob> {
src/core/util.rs:41
- [nitpick] The variable name
tempis generic; renaming it tovalueorentrywould improve readability.
let temp = map.get(key).context(selector::KeyMissing {
tests/pipeline.rs
Outdated
| //! process completes successfully and outputs the expected results. | ||
| pub mod fixture; | ||
| use std::{collections::HashMap, path::PathBuf, vec}; |
Copilot
AI
Jul 7, 2025
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.
The import of vec isn’t used anywhere in this test. Consider removing it to keep imports clean.
| use std::{collections::HashMap, path::PathBuf, vec}; | |
| use std::{collections::HashMap, path::PathBuf}; |
src/uniffi/orchestrator/docker.rs
Outdated
| .map(|(assigned_name, run_info)| { | ||
| let pod_job: PodJob = | ||
| serde_json::from_str(get(&run_info.labels, "org.orcapod.pod_job")?)?; | ||
| serde_json::from_str(get(&run_info.labels, &"org.orcapod.pod_job".to_owned())?)?; |
Copilot
AI
Jul 7, 2025
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.
[nitpick] Allocating a String inline for the label key is unnecessary. Consider defining a const POD_JOB_LABEL: &str = "org.orcapod.pod_job" and using &POD_JOB_LABEL.to_owned() or similar to avoid repeated to_owned() calls.
| serde_json::from_str(get(&run_info.labels, &"org.orcapod.pod_job".to_owned())?)?; | |
| serde_json::from_str(get(&run_info.labels, &POD_JOB_LABEL.to_owned())?)?; |
src/uniffi/pipeline.rs
Outdated
| Kernel::Mapper(mapper) => { | ||
| Ok(find_missing_keys(&input_packet, mapper.mapping.keys())) | ||
| } | ||
| Kernel::Joiner => Ok(Vec::<String>::new()), // Should probably error out because joiner should not be a root node |
Copilot
AI
Jul 7, 2025
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.
Joiner kernels should not be treated as root nodes. Either filter out Joiner before this check or return an error here to prevent silent omissions.
src/uniffi/pipeline.rs
Outdated
| #[expect(clippy::string_slice, reason = "Should never fail as we are in")] | ||
| pub fn get_kernel(&self, kernel_key: &str) -> Result<&Kernel> { | ||
| let char_to_cut_at = '_'; | ||
|
|
Copilot
AI
Jul 7, 2025
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.
[nitpick] The logic to strip after the last _ relies on naming conventions and may be confusing. Document the intention or restrict this slicing to node-based lookup rather than kernel hashes.
| // Document the slicing logic and validate the format of `kernel_key` | |
| // The `kernel_key` is expected to follow the format: "<prefix>_<suffix>" | |
| // where `<prefix>` is the meaningful part used for lookup. | |
| if !kernel_key.contains(char_to_cut_at) { | |
| return Err(OrcaError::new(Kind::InvalidInput, format!("Invalid kernel_key format: {}", kernel_key))); | |
| } |
…tom fixture from pod_job_custom, and allow input spec/packet to be configurable in pod_custom/pod_job_custom fixtures.
… tests, and remove unneeded manual sleeps in tests.
guzman-raphael
left a comment
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.
@Synicix I have completed my review of your PR and summarized my feedback into this PR to your fork. Let me know if you have any questions when you go over it.
I'd recommend merging it through GH to prevent merge conflicts between us and so my contributions show up in the commit history. If you'd like to make some changes yourself, it is probably best to do it after merging my PR to your fork.
Apply review feedback
Summary:
In short, I implemented from_dot to fit with the design of graph + kernel_lut where kernel_lut contains only the unique kernels to prevent duplicates. This will provided me with a minimum Pipeline for me to resume work on the pipeline runner. Also, it removes the need for pipeline_builder to be implemented in order to create test cases.
Added:
Updated:
Deferred:
For reference where these changes come from: