-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[ENH] chroma-load can save and restore running workloads to survive restarts. #3278
Conversation
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
rust/load/src/lib.rs
Outdated
/* | ||
/// A workload is a description of a set of operations to perform against a data set. | ||
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] | ||
pub enum Workload { | ||
/// No Operatioon; do nothing. | ||
#[serde(rename = "nop")] | ||
Nop, | ||
/// Resolve the workload by name. | ||
#[serde(rename = "by_name")] | ||
ByName(String), | ||
/// Get documents from the data set according to the query. | ||
#[serde(rename = "get")] | ||
Get(GetQuery), | ||
/// Query documents from the data set according to the query. | ||
#[serde(rename = "query")] | ||
Query(QueryQuery), | ||
/// A hybrid workload is a blend of other workloads. The blend is specified as a list of other | ||
/// valid workload. The probabilities are normalized to 1.0 before selection. | ||
#[serde(rename = "hybrid")] | ||
Hybrid(Vec<(f64, Workload)>), | ||
/// Delay the workload until after the specified time. | ||
#[serde(rename = "delay")] | ||
Delay { | ||
after: chrono::DateTime<chrono::FixedOffset>, | ||
wrap: Box<Workload>, | ||
}, | ||
/// Load the data set. Will repeatedly load until the time expires. | ||
#[serde(rename = "load")] | ||
Load, | ||
/// Randomly upsert a document. | ||
#[serde(rename = "random")] | ||
RandomUpsert(KeySelector), | ||
} | ||
*/ |
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.
should this be removed?
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.
Yes.
rust/load/src/lib.rs
Outdated
} | ||
} | ||
|
||
/// Set the persistent path. | ||
pub fn set_persistent_path(&mut self, persistent_path: Option<String>) -> Result<(), Error> { |
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.
I'm a little confused by this method name given it actually loads the persisted state; should LoadService::new()
take the persistent_path
as a parameter instead?
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.
I didn't make it a parameter because it failing to load should not fail the creation of the struct. I put it as a fallible method instead so that the error can be logged as a warning and the config dropped.
53f8ac8
to
a0ed1e9
Compare
…estarts. Serialize the running workloads to a JSON blob when the configuration option `persistent_state_path` is set to a non-None value.
4a84fa6
to
d8f0ebf
Compare
Serialize the running workloads to a JSON blob when the configuration
option
persistent_state_path
is set to a non-None value.