Skip to content

Commit

Permalink
feat: remove tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra committed Feb 8, 2024
1 parent 17ec5e3 commit ffb1ea6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 46 deletions.
5 changes: 3 additions & 2 deletions 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
2 changes: 1 addition & 1 deletion crates/rattler_installs_packages/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
58 changes: 16 additions & 42 deletions crates/rattler_installs_packages/src/resolve/dependency_provider.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand All @@ -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;

Expand All @@ -49,9 +44,6 @@ pub(crate) struct PypiDependencyProvider {

options: ResolveOptions,
should_cancel_with_value: Mutex<Option<MetadataError>>,

concurrent_metadata_fetches: AtomicUsize,
concurrent_candidate_fetches: AtomicUsize,
}

impl PypiDependencyProvider {
Expand Down Expand Up @@ -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),
})
}

Expand Down Expand Up @@ -306,11 +296,6 @@ impl<'p> DependencyProvider<PypiVersionSet, PypiPackageName> 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(),
Expand All @@ -328,10 +313,6 @@ impl<'p> DependencyProvider<PypiVersionSet, PypiPackageName> 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) => {
Expand Down Expand Up @@ -517,10 +498,6 @@ impl<'p> DependencyProvider<PypiVersionSet, PypiPackageName> 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();
Expand All @@ -538,9 +515,6 @@ impl<'p> DependencyProvider<PypiVersionSet, PypiPackageName> 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
Expand Down

0 comments on commit ffb1ea6

Please sign in to comment.