Skip to content

change info! to notice! log levels #1613

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
16 changes: 12 additions & 4 deletions pgml-extension/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 12 additions & 11 deletions pgml-extension/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand All @@ -213,7 +213,7 @@ fn train_joint(
);

if materialize_snapshot {
info!(
notice!(
"Snapshot of table \"{}\" created and saved in {}",
relation_name,
snapshot.snapshot_name(),
Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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
);
Expand All @@ -909,7 +910,7 @@ fn tune(
);

if materialize_snapshot {
info!(
notice!(
"Snapshot of table \"{}\" created and saved in {}",
relation_name,
snapshot.snapshot_name(),
Expand Down Expand Up @@ -1619,7 +1620,7 @@ mod tests {
// to test deployments.
let setting = Spi::get_one::<String>("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(
Expand Down Expand Up @@ -1657,7 +1658,7 @@ mod tests {
// to test deployments.
let setting = Spi::get_one::<String>("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(
Expand Down Expand Up @@ -1695,7 +1696,7 @@ mod tests {
// to test deployments.
let setting = Spi::get_one::<String>("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(
Expand Down
16 changes: 8 additions & 8 deletions pgml-extension/src/orm/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl Model {

let mut model = model.unwrap();

info!("Training {}", model);
notice!("Training {}", model);
model.fit(&dataset);

Spi::run_with_args(
Expand Down Expand Up @@ -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<String, f64>;
match dataset {
TextDatasetType::TextClassification(dataset) => {
Expand Down Expand Up @@ -267,7 +267,7 @@ impl Model {
};

model.metrics = Some(JsonB(json!(metrics)));
info!("Metrics: {:?}", &metrics);
notice!("Metrics: {:?}", &metrics);

Spi::get_one_with_args::<i64>(
"UPDATE pgml.models SET hyperparams = $1, metrics = $2 WHERE id = $3 RETURNING id",
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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<String, f32> {
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;
Expand Down Expand Up @@ -724,7 +724,7 @@ impl Model {
dataset: &Dataset,
hyperparams: &Hyperparams,
) -> (Box<dyn Bindings>, IndexMap<String, f32>) {
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();
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pgml-extension/src/orm/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<i64>(
"INSERT INTO pgml.deployments (project_id, model_id, strategy) VALUES ($1, $2, $3::pgml.strategy) RETURNING id",
vec![
Expand Down
10 changes: 5 additions & 5 deletions pgml-extension/src/orm/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ impl Column {
}
}

info!("Column {:?}: {:?}", self.name, statistics);
notice!("Column {:?}: {:?}", self.name, statistics);
}
}

Expand Down Expand Up @@ -860,7 +860,7 @@ impl Snapshot {

let data = data.unwrap();

info!("{}", data);
notice!("{}", data);

data
}
Expand Down Expand Up @@ -963,7 +963,7 @@ impl Snapshot {

let data = data.unwrap();

info!("{}", data);
notice!("{}", data);

data
}
Expand Down Expand Up @@ -1058,7 +1058,7 @@ impl Snapshot {

let data = data.unwrap();

info!("{}", data);
notice!("{}", data);

data
}
Expand Down Expand Up @@ -1364,7 +1364,7 @@ impl Snapshot {

let data = data.unwrap();

info!("{}", data);
notice!("{}", data);

data
}
Expand Down
Loading