diff --git a/Cargo.lock b/Cargo.lock index e572ad6c..074e77ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2477,8 +2477,9 @@ dependencies = [ [[package]] name = "resolvo" -version = "0.3.0" -source = "git+https://github.com/baszalmstra/resolvo.git?branch=refactor/concurrent-metadata-fetch#82c804ddf9e07adbe1a1b33989ca1c4016f84d48" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2016584c3fd9df0fd859a7dcbc7fafdc7fdd2d87b53a576e8e63e62fad140e33" dependencies = [ "bitvec", "elsa", diff --git a/Cargo.toml b/Cargo.toml index 995fd7a9..53486992 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,5 +21,4 @@ consolidate-commits = true tag-prefix = "" [patch.crates-io] -resolvo = { git = "https://github.com/baszalmstra/resolvo.git", branch = "refactor/concurrent-metadata-fetch" } pyproject-toml = { git = "https://github.com/wolfv/pyproject-toml-rs", branch = "update-deps" } diff --git a/crates/rattler_installs_packages/Cargo.toml b/crates/rattler_installs_packages/Cargo.toml index 363b663e..95dfe4f6 100644 --- a/crates/rattler_installs_packages/Cargo.toml +++ b/crates/rattler_installs_packages/Cargo.toml @@ -58,7 +58,7 @@ tokio-util = { version = "0.7.10", features = ["compat"] } tracing = { version = "0.1.40", default-features = false, features = ["attributes"] } url = { version = "2.5.0", features = ["serde"] } zip = "0.6.6" -resolvo = { version = "0.3.0", default-features = false, features = ["tokio"] } +resolvo = { version = "0.4.0", default-features = false, features = ["tokio"] } pathdiff = "0.2.1" async_zip = { version = "0.0.16", features = ["tokio", "deflate"] } tar = "0.4.40" diff --git a/crates/rattler_installs_packages/src/resolve/dependency_provider.rs b/crates/rattler_installs_packages/src/resolve/dependency_provider.rs index 217ae3bb..3def4270 100644 --- a/crates/rattler_installs_packages/src/resolve/dependency_provider.rs +++ b/crates/rattler_installs_packages/src/resolve/dependency_provider.rs @@ -1,14 +1,17 @@ -use crate::artifacts::SDist; -use crate::artifacts::Wheel; -use crate::index::{ArtifactRequest, PackageDb}; -use crate::python_env::WheelTags; -use crate::resolve::solve_options::SDistResolution; -use crate::resolve::solve_options::{PreReleaseResolution, ResolveOptions}; -use crate::resolve::PinnedPackage; -use crate::types::{ - ArtifactFromBytes, ArtifactInfo, ArtifactName, Extra, NormalizedPackageName, PackageName, +use super::{ + pypi_version_types::PypiPackageName, + solve_options::{PreReleaseResolution, ResolveOptions, SDistResolution}, + PinnedPackage, PypiVersion, PypiVersionSet, +}; +use crate::{ + artifacts::{SDist, Wheel}, + index::{ArtifactRequest, PackageDb}, + python_env::WheelTags, + types::{ + ArtifactFromBytes, ArtifactInfo, ArtifactName, Extra, NormalizedPackageName, PackageName, + }, + wheel_builder::WheelBuilder, }; -use crate::wheel_builder::WheelBuilder; use elsa::FrozenMap; use itertools::Itertools; use miette::{Diagnostic, IntoDiagnostic, MietteDiagnostic}; @@ -19,17 +22,9 @@ use resolvo::{ Candidates, Dependencies, DependencyProvider, KnownDependencies, NameId, Pool, SolvableId, SolverCache, }; -use std::any::Any; -use std::borrow::Borrow; -use std::cmp::Ordering; -use std::collections::HashMap; -use std::fmt::{Display, Formatter}; -use std::rc::Rc; - -use crate::resolve::pypi_version_types::{PypiPackageName, PypiVersion, PypiVersionSet}; -use std::str::FromStr; -use std::sync::atomic::AtomicUsize; -use std::sync::Arc; +use std::{ + any::Any, borrow::Borrow, cmp::Ordering, collections::HashMap, rc::Rc, str::FromStr, sync::Arc, +}; use thiserror::Error; use url::Url; @@ -49,9 +44,6 @@ pub(crate) struct PypiDependencyProvider { options: ResolveOptions, should_cancel_with_value: Mutex>, - - concurrent_metadata_fetches: AtomicUsize, - concurrent_candidate_fetches: AtomicUsize, } impl PypiDependencyProvider { @@ -92,8 +84,6 @@ impl PypiDependencyProvider { name_to_url, options, should_cancel_with_value: Default::default(), - concurrent_metadata_fetches: AtomicUsize::new(0), - concurrent_candidate_fetches: AtomicUsize::new(0), }) } @@ -306,11 +296,6 @@ impl<'p> DependencyProvider for &'p PypiDepende // check if we have URL variant for this name let url_version = self.name_to_url.get(package_name.base()); - let concurrency_count = self - .concurrent_candidate_fetches - .fetch_add(1, std::sync::atomic::Ordering::AcqRel); - tracing::info!("requesting candidates #{}", concurrency_count); - let request = if let Some(url) = url_version { ArtifactRequest::DirectUrl { name: package_name.base().clone(), @@ -328,10 +313,6 @@ impl<'p> DependencyProvider for &'p PypiDepende .await .expect("cancelled"); - tracing::info!("DONE requesting candidates #{}", concurrency_count); - self.concurrent_candidate_fetches - .fetch_sub(1, std::sync::atomic::Ordering::Relaxed); - let artifacts = match result { Ok(artifacts) => artifacts, Err(err) => { @@ -517,10 +498,6 @@ impl<'p> DependencyProvider for &'p PypiDepende return Dependencies::Unknown(error); } - let concurrency_count = self - .concurrent_metadata_fetches - .fetch_add(1, std::sync::atomic::Ordering::AcqRel); - tracing::info!("fetching metadata #{}", concurrency_count); let result: miette::Result<_> = tokio::spawn({ let package_db = self.package_db.clone(); let wheel_builder = self.wheel_builder.clone(); @@ -538,9 +515,6 @@ impl<'p> DependencyProvider for &'p PypiDepende }) .await .expect("cancelled"); - tracing::info!("DONE fetching metadata #{}", concurrency_count); - self.concurrent_metadata_fetches - .fetch_sub(1, std::sync::atomic::Ordering::Relaxed); let metadata = match result { // We have retrieved a value without error