Skip to content
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

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

rescrv
Copy link
Contributor

@rescrv rescrv commented Dec 10, 2024

Serialize the running workloads to a JSON blob when the configuration
option persistent_state_path is set to a non-None value.

Copy link

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)

@rescrv rescrv requested a review from codetheweb December 10, 2024 18:32
Comment on lines 570 to 603
/*
/// 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),
}
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

}
}

/// Set the persistent path.
pub fn set_persistent_path(&mut self, persistent_path: Option<String>) -> Result<(), Error> {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@rescrv rescrv force-pushed the rescrv/persist-chroma-load branch from 53f8ac8 to a0ed1e9 Compare December 10, 2024 19:19
Base automatically changed from rescrv/docs to main December 10, 2024 20:43
…estarts.

Serialize the running workloads to a JSON blob when the configuration
option `persistent_state_path` is set to a non-None value.
@rescrv rescrv force-pushed the rescrv/persist-chroma-load branch from 4a84fa6 to d8f0ebf Compare December 10, 2024 21:40
@rescrv rescrv merged commit af9e0f4 into main Dec 10, 2024
69 of 71 checks passed
@rescrv rescrv deleted the rescrv/persist-chroma-load branch December 10, 2024 22:13
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.

2 participants