Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a09cb8b
Reset git commit for pod-job
Synicix Nov 1, 2024
2673a90
Add docs to deal with clippy complaints
Synicix Nov 1, 2024
72c7391
Merge and added input for pod job
Synicix Nov 14, 2024
73c61c0
Change input data to use store compute_checksum
Synicix Nov 14, 2024
b2c987a
Add pod job scaffolding
Synicix Nov 15, 2024
60db1a3
Fix a few bugs and added tests
Synicix Nov 15, 2024
a47b2fb
Fix filepath bug
Synicix Nov 15, 2024
0a50223
remove unused code
Synicix Nov 15, 2024
beb7b81
Remove random image generation to prevent hash from changing
Synicix Nov 16, 2024
4465013
Save progress for now, still need to be cleaned up
Synicix Dec 6, 2024
47018de
Fix a few clippy problems, still need to add some test cases
Synicix Dec 6, 2024
82623e1
Change design of StorePointer
Synicix Dec 10, 2024
7f7dd55
Added test for StorePointer
Synicix Dec 10, 2024
44884c9
Rename and added to_yaml for StorePointer
Synicix Dec 10, 2024
90078b5
Fix last few remianing change request
Synicix Dec 12, 2024
a031713
Renaming
Synicix Dec 17, 2024
8046483
Simplify `to_yaml` by using serde builtin features, update `Pod` fiel…
guzman-raphael Jan 15, 2025
ac0a4f8
Move model storage to `{store_directory}/orcapod_model`, add default …
guzman-raphael Jan 15, 2025
296fcff
Remove `from_yaml` in favor of loading explicitly, add pod serializer…
guzman-raphael Jan 19, 2025
b40daa2
Refactor error module to use `thiserror`, remove unneeded `anyhow`, s…
guzman-raphael Jan 20, 2025
2601c8a
remove store pointer
Synicix Jan 20, 2025
678f724
Update pod job to use new loading key system for pod
Synicix Jan 20, 2025
e53ccb9
Change to new seralizer with
Synicix Jan 21, 2025
326f3f4
Add input/output config to PodJob, add blob interface for computing c…
guzman-raphael Jan 21, 2025
4fbccf0
Remove restriction on a model requiring at least one annotation, remo…
guzman-raphael Jan 21, 2025
b749f64
Clean up.
guzman-raphael Jan 21, 2025
4b7ffad
Merge branch 'pod_job' into Synicix/pod-job2
guzman-raphael Jan 22, 2025
c0fb2cf
Fix missing files.
guzman-raphael Jan 22, 2025
e9e3342
Merge pull request #2 from guzman-raphael/Synicix/pod-job2
Synicix Jan 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ excessive-nesting-threshold = 3
too-many-arguments-threshold = 10
allowed-prefixes = ["..", "GPU", "Orca"]
min-ident-chars-threshold = 2
allowed-idents-below-min-chars = ["..", "k", "f", "re", "id"]
allowed-idents-below-min-chars = ["..", "k", "f", "re", "id", "Ok"]
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"source=${localWorkspaceFolderBasename}_devcontainer_docker_data,target=/var/lib/docker,type=volume"
],
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}",
"RUST_BACKTRACE": "1"
},
"postStartCommand": "docker system prune -fa && docker volume prune -f",
"hostRequirements": {
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ jobs:
- name: Run format test
run: cargo fmt --check
- name: Run integration tests w/ coverage report
run: cargo llvm-cov -- --nocapture
env:
RUST_BACKTRACE: full
run: cargo llvm-cov -- --nocapture
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ glob = "0.3.1"
regex = "1.11.0"
heck = "0.5.0"
colored = "2.1.0"
thiserror = "2.0.11"

[dev-dependencies]
tempfile = "3.13.0"
Expand Down Expand Up @@ -93,9 +94,9 @@ std_instead_of_alloc = { level = "allow", priority = 127 } # we shou
std_instead_of_core = { level = "allow", priority = 127 } # we should use std when possible
string_add = { level = "allow", priority = 127 } # simple concat ok
string_lit_chars_any = { level = "allow", priority = 127 } # favor readability until a perf case comes up
todo = { level = "warn", priority = 127 } # warn todos
use_debug = { level = "warn", priority = 127 } # debug print

# temporary
single_call_fn = { level = "allow", priority = 127 } # remove once other models are in
todo = { level = "allow", priority = 127 } # allow until folder hash and input collection cases are complete, then warn todos
single_call_fn = { level = "allow", priority = 127 } # remove once more models need pointer serializers/deserializers
tests_outside_test_module = { level = "allow", priority = 127 } # for now due to false-positive for integration tests: https://github.com/rust-lang/rust-clippy/pull/13038
3 changes: 2 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"millicores",
"zenmldocker",
"zenml",
"indoc"
"indoc",
"thiserror"
]
}
120 changes: 45 additions & 75 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,111 +3,81 @@ use glob;
use regex;
use serde_yaml;
use std::{
error::Error,
fmt,
fmt::{Display, Formatter},
io,
path::PathBuf,
result,
};
use thiserror::Error;
/// Shorthand for a Result that returns an `OrcaError`.
pub type Result<T> = result::Result<T, OrcaError>;

/// Possible errors you may encounter.
#[derive(Debug)]
#[derive(Error, Debug)]
pub(crate) enum Kind {
/// Returned if a file is not expected to exist.
FileExists(PathBuf),
/// Returned if an annotation was expected to exist.
NoAnnotationFound(String, String, String),
/// Returned if a model save was attempted without an annotation set.
MissingAnnotationOnSave,
/// Returned if an annotation delete was attempted on a model's last annotation.
DeletingLastAnnotation(String, String, String),
/// Returned if a regular expression was expected to match.
NoRegexMatch,
/// Wrapper around `glob::GlobError`
GlobError(glob::GlobError),
/// Wrapper around `glob::PatternError`
GlobPatternError(glob::PatternError),
/// Wrapper around `regex::Error`
RegexError(regex::Error),
/// Wrapper around `serde_yaml::Error`
SerdeYamlError(serde_yaml::Error),
/// Wrapper around `io::Error`
IoError(io::Error),
#[error("File `{}` already exists.", path.to_string_lossy().bright_cyan())]
FileExists { path: PathBuf },
#[error("No annotation found for `{name}:{version}` {class}.")]
NoAnnotationFound {
class: String,
name: String,
version: String,
},
#[error(transparent)]
GlobPatternError(#[from] glob::PatternError),
#[error(transparent)]
RegexError(#[from] regex::Error),
#[error(transparent)]
SerdeYamlError(#[from] serde_yaml::Error),
#[error(transparent)]
IoError(#[from] io::Error),
}

/// A stable error API interface.
#[derive(Debug)]
pub struct OrcaError(Kind);
impl Error for OrcaError {}
#[derive(Error, Debug)]
pub struct OrcaError {
kind: Kind,
}
impl OrcaError {
/// Returns `true` if the error was caused by an attempt to delete a model's last annotation.
pub const fn is_deleting_last_annotation(&self) -> bool {
matches!(self.0, Kind::DeletingLastAnnotation(_, _, _))
/// Returns `true` if the error was caused by an invalid model annotation.
pub const fn is_invalid_annotation(&self) -> bool {
matches!(self.kind, Kind::NoAnnotationFound { .. })
}
}
impl Display for OrcaError {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
match &self.0 {
Kind::FileExists(path) => {
write!(
f,
"File `{}` already exists.",
path.to_string_lossy().bright_cyan()
)
}
Kind::NoAnnotationFound(class, name, version) => {
write!(f, "No annotation found for `{name}:{version}` {class}.")
}
Kind::MissingAnnotationOnSave => {
write!(f, "No annotation found when attempting to store.")
}
Kind::DeletingLastAnnotation(class, name, version) => {
write!(
f,
"Attempted to delete the last annotation for `{name}:{version}` {class}."
)
}
Kind::NoRegexMatch => {
write!(f, "No match for regex.")
}
Kind::GlobError(error) => write!(f, "{error}"),
Kind::GlobPatternError(error) => write!(f, "{error}"),
Kind::SerdeYamlError(error) => write!(f, "{error}"),
Kind::RegexError(error) => write!(f, "{error}"),
Kind::IoError(error) => write!(f, "{error}"),
}
}
}
impl From<glob::GlobError> for OrcaError {
fn from(error: glob::GlobError) -> Self {
Self(Kind::GlobError(error))
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.kind)
}
}
impl From<glob::PatternError> for OrcaError {
fn from(error: glob::PatternError) -> Self {
Self(Kind::GlobPatternError(error))
}
}
impl From<serde_yaml::Error> for OrcaError {
fn from(error: serde_yaml::Error) -> Self {
Self(Kind::SerdeYamlError(error))
Self {
kind: Kind::GlobPatternError(error),
}
}
}
impl From<regex::Error> for OrcaError {
fn from(error: regex::Error) -> Self {
Self(Kind::RegexError(error))
Self {
kind: Kind::RegexError(error),
}
}
}
impl From<serde_yaml::Error> for OrcaError {
fn from(error: serde_yaml::Error) -> Self {
Self {
kind: Kind::SerdeYamlError(error),
}
}
}
impl From<io::Error> for OrcaError {
fn from(error: io::Error) -> Self {
Self(Kind::IoError(error))
Self {
kind: Kind::IoError(error),
}
}
}
impl From<Kind> for OrcaError {
fn from(error: Kind) -> Self {
Self(error)
fn from(kind: Kind) -> Self {
Self { kind }
}
}
Loading
Loading