INNER CODE UNIT · Rust

installed_packages

EricLBuehler/mistral.rs · mistralrs-code-exec/src/lib.rs:268

async fn installed_packages(python_path: &Path) -> String {
    let output = tokio::process::Command::new(python_path)
        .args(["-m", "pip", "list", "--format=freeze"])
        .output()
        .await;
    match output {
        Ok(o) if o.status.success() => String::from_utf8_lossy(&o.stdout).to_string(),
        _ => "(pip list unavailable)".to_string(),
    }
}

fn spawn_reaper(sessions: Arc<Mutex<HashMap<String, Arc<Mutex<PythonSession>>>>>) {
    tokio::spawn(async move {
        loop {
            tokio::time::sleep(REAP_INTERVAL).await;
            let mut map = sessions.lock().await;
            let before = map.len();
            let mut to_remove = Vec::new();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…