Content-Length: 11557 | pFad | http://github.com/postgresml/postgresml/pull/1613.patch
thub.com
From e8d1bddfa604b473459d9fb98baf00bd0a50f058 Mon Sep 17 00:00:00 2001
From: Kevin Zimmerman <4733573+kczimm@users.noreply.github.com>
Date: Wed, 28 Aug 2024 13:34:33 -0500
Subject: [PATCH 1/3] change info! to notice! log levels
---
pgml-extension/src/api.rs | 23 ++++++++++++-----------
pgml-extension/src/orm/model.rs | 16 ++++++++--------
pgml-extension/src/orm/project.rs | 2 +-
pgml-extension/src/orm/snapshot.rs | 10 +++++-----
4 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/pgml-extension/src/api.rs b/pgml-extension/src/api.rs
index 923c6fc70..f7a3f9697 100644
--- a/pgml-extension/src/api.rs
+++ b/pgml-extension/src/api.rs
@@ -188,13 +188,13 @@ fn train_joint(
"You must pass a `relation_name` and `y_column_name` to snapshot the first time you train a model.",
);
- info!("Using existing snapshot from {}", snapshot.snapshot_name(),);
+ notice!("Using existing snapshot from {}", snapshot.snapshot_name(),);
snapshot
}
Some(relation_name) => {
- info!(
+ notice!(
"Snapshotting table \"{}\", this may take a little while...",
relation_name
);
@@ -213,7 +213,7 @@ fn train_joint(
);
if materialize_snapshot {
- info!(
+ notice!(
"Snapshot of table \"{}\" created and saved in {}",
relation_name,
snapshot.snapshot_name(),
@@ -276,9 +276,10 @@ fn train_joint(
let deployed_metric = deployed_metrics_obj
.get(&default_target_metric)
.and_then(|v| v.as_f64());
- info!(
+ notice!(
"Comparing to deployed model {}: {:?}",
- default_target_metric, deployed_metric
+ default_target_metric,
+ deployed_metric
);
let new_metric = new_metrics.get(&default_target_metric).and_then(|v| v.as_f64());
@@ -888,13 +889,13 @@ fn tune(
"You must pass a `relation_name` and `y_column_name` to snapshot the first time you train a model.",
);
- info!("Using existing snapshot from {}", snapshot.snapshot_name(),);
+ notice!("Using existing snapshot from {}", snapshot.snapshot_name(),);
snapshot
}
Some(relation_name) => {
- info!(
+ notice!(
"Snapshotting table \"{}\", this may take a little while...",
relation_name
);
@@ -909,7 +910,7 @@ fn tune(
);
if materialize_snapshot {
- info!(
+ notice!(
"Snapshot of table \"{}\" created and saved in {}",
relation_name,
snapshot.snapshot_name(),
@@ -1619,7 +1620,7 @@ mod tests {
// to test deployments.
let setting = Spi::get_one::("select setting from pg_settings where name = 'data_directory'").unwrap();
- info!("Data directory: {}", setting.unwrap());
+ notice!("Data directory: {}", setting.unwrap());
for runtime in [Runtime::python, Runtime::rust] {
let result: Vec<(String, String, String, bool)> = train(
@@ -1657,7 +1658,7 @@ mod tests {
// to test deployments.
let setting = Spi::get_one::("select setting from pg_settings where name = 'data_directory'").unwrap();
- info!("Data directory: {}", setting.unwrap());
+ notice!("Data directory: {}", setting.unwrap());
for runtime in [Runtime::python, Runtime::rust] {
let result: Vec<(String, String, String, bool)> = train(
@@ -1695,7 +1696,7 @@ mod tests {
// to test deployments.
let setting = Spi::get_one::("select setting from pg_settings where name = 'data_directory'").unwrap();
- info!("Data directory: {}", setting.unwrap());
+ notice!("Data directory: {}", setting.unwrap());
for runtime in [Runtime::python, Runtime::rust] {
let result: Vec<(String, String, String, bool)> = train(
diff --git a/pgml-extension/src/orm/model.rs b/pgml-extension/src/orm/model.rs
index 670e05651..c2678c9b3 100644
--- a/pgml-extension/src/orm/model.rs
+++ b/pgml-extension/src/orm/model.rs
@@ -139,7 +139,7 @@ impl Model {
let mut model = model.unwrap();
- info!("Training {}", model);
+ notice!("Training {}", model);
model.fit(&dataset);
Spi::run_with_args(
@@ -222,7 +222,7 @@ impl Model {
let id = model.id;
let path = std::path::PathBuf::from(format!("/tmp/postgresml/models/{id}"));
- info!("Tuning {}", model);
+ notice!("Tuning {}", model);
let metrics: HashMap;
match dataset {
TextDatasetType::TextClassification(dataset) => {
@@ -267,7 +267,7 @@ impl Model {
};
model.metrics = Some(JsonB(json!(metrics)));
- info!("Metrics: {:?}", &metrics);
+ notice!("Metrics: {:?}", &metrics);
Spi::get_one_with_args::(
"UPDATE pgml.models SET hyperparams = $1, metrics = $2 WHERE id = $3 RETURNING id",
@@ -439,7 +439,7 @@ impl Model {
}
}
- info!("Model cache miss {:?}", id);
+ notice!("Model cache miss {:?}", id);
let model = Arc::new(Model::find(id)?);
let mut models = DEPLOYED_MODELS_BY_ID.lock();
models.insert(id, Arc::clone(&model));
@@ -611,7 +611,7 @@ impl Model {
// The box is borrowed so that it may be reused by the caller
#[allow(clippy::borrowed_box)]
fn test(&self, dataset: &Dataset) -> IndexMap {
- info!("Testing {:?} estimator {:?}", self.project.task, self);
+ notice!("Testing {:?} estimator {:?}", self.project.task, self);
// Test the estimator on the data
let y_hat = self.predict_batch(&dataset.x_test).unwrap();
let y_test = &dataset.y_test;
@@ -724,7 +724,7 @@ impl Model {
dataset: &Dataset,
hyperparams: &Hyperparams,
) -> (Box, IndexMap) {
- info!("Hyperparams: {}", serde_json::to_string_pretty(hyperparams).unwrap());
+ notice!("Hyperparams: {}", serde_json::to_string_pretty(hyperparams).unwrap());
let fit = self.get_fit_function();
let now = Instant::now();
@@ -737,7 +737,7 @@ impl Model {
metrics.insert("fit_time".to_string(), fit_time.as_secs_f32());
metrics.insert("score_time".to_string(), score_time.as_secs_f32());
- info!("Metrics: {:?}", &metrics);
+ notice!("Metrics: {:?}", &metrics);
let mut bindings = None;
std::mem::swap(&mut self.bindings, &mut bindings);
@@ -804,7 +804,7 @@ impl Model {
let mut all_bindings = Vec::with_capacity(all_hyperparams.len());
let mut all_metrics = Vec::with_capacity(all_hyperparams.len());
- info!(
+ notice!(
"Hyperparameter searches: {}, cross validation folds: {}",
all_hyperparams.len(),
cv
diff --git a/pgml-extension/src/orm/project.rs b/pgml-extension/src/orm/project.rs
index ea23ba80e..b1820390f 100644
--- a/pgml-extension/src/orm/project.rs
+++ b/pgml-extension/src/orm/project.rs
@@ -74,7 +74,7 @@ impl Project {
}
pub fn deploy(&self, model_id: i64, strategy: Strategy) {
- info!("Deploying model id: {:?}", model_id);
+ notice!("Deploying model id: {:?}", model_id);
Spi::get_one_with_args::(
"INSERT INTO pgml.deployments (project_id, model_id, strategy) VALUES ($1, $2, $3::pgml.strategy) RETURNING id",
vec![
diff --git a/pgml-extension/src/orm/snapshot.rs b/pgml-extension/src/orm/snapshot.rs
index 7b1db546a..acbc9200c 100644
--- a/pgml-extension/src/orm/snapshot.rs
+++ b/pgml-extension/src/orm/snapshot.rs
@@ -334,7 +334,7 @@ impl Column {
}
}
- info!("Column {:?}: {:?}", self.name, statistics);
+ notice!("Column {:?}: {:?}", self.name, statistics);
}
}
@@ -860,7 +860,7 @@ impl Snapshot {
let data = data.unwrap();
- info!("{}", data);
+ notice!("{}", data);
data
}
@@ -963,7 +963,7 @@ impl Snapshot {
let data = data.unwrap();
- info!("{}", data);
+ notice!("{}", data);
data
}
@@ -1058,7 +1058,7 @@ impl Snapshot {
let data = data.unwrap();
- info!("{}", data);
+ notice!("{}", data);
data
}
@@ -1364,7 +1364,7 @@ impl Snapshot {
let data = data.unwrap();
- info!("{}", data);
+ notice!("{}", data);
data
}
From 37364cd5e56138a5b0dcf2557cc52ea573e5c1b0 Mon Sep 17 00:00:00 2001
From: Kevin Zimmerman <4733573+kczimm@users.noreply.github.com>
Date: Wed, 28 Aug 2024 14:34:06 -0500
Subject: [PATCH 2/3] update time crate
---
pgml-extension/Cargo.lock | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/pgml-extension/Cargo.lock b/pgml-extension/Cargo.lock
index c32c19272..4c0c1c874 100644
--- a/pgml-extension/Cargo.lock
+++ b/pgml-extension/Cargo.lock
@@ -1514,6 +1514,12 @@ dependencies = [
"num-traits",
]
+[[package]]
+name = "num-conv"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
+
[[package]]
name = "num-integer"
version = "0.1.45"
@@ -2815,13 +2821,14 @@ dependencies = [
[[package]]
name = "time"
-version = "0.3.31"
+version = "0.3.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e"
+checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
dependencies = [
"deranged",
"itoa",
"libc",
+ "num-conv",
"num_threads",
"powerfmt",
"serde",
@@ -2837,10 +2844,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
[[package]]
name = "time-macros"
-version = "0.2.16"
+version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f"
+checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
dependencies = [
+ "num-conv",
"time-core",
]
From ac45912f9c86555196c80628511be6a0fa5e8aa2 Mon Sep 17 00:00:00 2001
From: Kevin Zimmerman <4733573+kczimm@users.noreply.github.com>
Date: Wed, 28 Aug 2024 15:13:41 -0500
Subject: [PATCH 3/3] bump CI rust version
---
.github/workflows/ci.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4c63d53cd..8287b93ca 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -45,7 +45,7 @@ jobs:
~/.cargo
pgml-extension/target
~/.pgrx
- key: ${{ runner.os }}-rust-1.74-${{ hashFiles('pgml-extension/Cargo.lock') }}-bust2
+ key: ${{ runner.os }}-rust-1.79-${{ hashFiles('pgml-extension/Cargo.lock') }}-bust2
- name: Install pgrx
if: steps.pgml_extension_changed.outputs.PGML_EXTENSION_CHANGED_FILES != '0'
run: |
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/postgresml/postgresml/pull/1613.patch
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy