mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-27 15:10:05 +01:00
Add a jobs
parameter to set the number of threads the indexer uses
This commit is contained in:
parent
2a3b03138b
commit
adb1038b26
@ -46,6 +46,10 @@ struct Opt {
|
||||
#[structopt(long, default_value = "100000")]
|
||||
arc_cache_size: usize,
|
||||
|
||||
/// Number of parallel jobs, defaults to # of CPUs.
|
||||
#[structopt(short, long)]
|
||||
jobs: Option<usize>,
|
||||
|
||||
/// CSV file to index.
|
||||
csv_file: PathBuf,
|
||||
}
|
||||
@ -468,6 +472,10 @@ fn open_env_index(path: impl AsRef<Path>) -> anyhow::Result<(Env, Index)> {
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let opt = Opt::from_args();
|
||||
|
||||
if let Some(jobs) = opt.jobs {
|
||||
rayon::ThreadPoolBuilder::new().num_threads(jobs).build_global()?;
|
||||
}
|
||||
|
||||
std::fs::create_dir_all(&opt.database)?;
|
||||
let (env, index) = open_env_index(&opt.database)?;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user