🌐 AI搜索 & 代理 主页
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Address review comments.
  • Loading branch information
higuoxing committed Apr 5, 2024
commit 4e84e083c7ed45d6496aa70489462bd01a227c06
1 change: 0 additions & 1 deletion pgml-extension/Cargo.lock

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

1 change: 0 additions & 1 deletion pgml-extension/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ serde = { version = "1.0" }
serde_json = { version = "1.0", features = ["preserve_order"] }
typetag = "0.2"
xgboost = { git = "https://github.com/postgresml/rust-xgboost", branch = "master" }
lazy_static = "1.4.0"

[dev-dependencies]
pgrx-tests = "=0.11.3"
Expand Down
28 changes: 15 additions & 13 deletions pgml-extension/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use pgrx::{GucContext, GucFlags, GucRegistry, GucSetting};
use std::ffi::CStr;

#[cfg(any(test, feature = "pg_test"))]
use pgrx::{pg_schema, pg_test};

lazy_static! {
pub static ref PGML_VENV: (&'static str, GucSetting<Option<&'static CStr>>) =
("pgml.venv", GucSetting::<Option<&'static CStr>>::new(None));
pub static ref PGML_HF_WHITELIST: (&'static str, GucSetting<Option<&'static CStr>>) = (
pub static PGML_VENV: Lazy<(&'static str, GucSetting<Option<&'static CStr>>)> =
Lazy::new(|| ("pgml.venv", GucSetting::<Option<&'static CStr>>::new(None)));
pub static PGML_HF_WHITELIST: Lazy<(&'static str, GucSetting<Option<&'static CStr>>)> = Lazy::new(|| {
(
"pgml.huggingface_whitelist",
GucSetting::<Option<&'static CStr>>::new(None),
);
pub static ref PGML_HF_TRUST_REMOTE_CODE: (&'static str, GucSetting<bool>) =
("pgml.huggingface_trust_remote_code", GucSetting::<bool>::new(false));
pub static ref PGML_HF_TRUST_WHITELIST: (&'static str, GucSetting<Option<&'static CStr>>) = (
)
});
pub static PGML_HF_TRUST_REMOTE_CODE: Lazy<(&'static str, GucSetting<bool>)> =
Lazy::new(|| ("pgml.huggingface_trust_remote_code", GucSetting::<bool>::new(false)));
pub static PGML_HF_TRUST_WHITELIST: Lazy<(&'static str, GucSetting<Option<&'static CStr>>)> = Lazy::new(|| {
(
"pgml.huggingface_trust_remote_code_whitelist",
GucSetting::<Option<&'static CStr>>::new(None),
);
pub static ref PGML_OMP_NUM_THREADS: (&'static str, GucSetting<i32>) =
("pgml.omp_num_threads", GucSetting::<i32>::new(-1));
}
)
});
pub static PGML_OMP_NUM_THREADS: Lazy<(&'static str, GucSetting<i32>)> =
Lazy::new(|| ("pgml.omp_num_threads", GucSetting::<i32>::new(-1)));

pub fn initialize_server_params() {
GucRegistry::define_string_guc(
Expand Down