feat: Accept sparse repodata in solve - #2627
Conversation
200ce7b to
eee59e6
Compare
| )); | ||
| }; | ||
| sparse | ||
| .load_records(&name, PackageFormatSelection::PreferCondaWithWhl) |
There was a problem hiding this comment.
I'm not sure about this package format selection here. In rattler.solve_with_sparse_repodata we have a package_format_selection field that the user can set.
Should this pr be updated so that rattler.solve also supports this parameter?
There was a problem hiding this comment.
I think that would be worth a seperate PR but yeah adding the package_format_selection to the gateway query (and thus the rattler.solve function) makes a lot of sense to me.
There was a problem hiding this comment.
Something along the lines of:
gateway
.query(sources, platforms, specs)
.package_format_selection(PackageFormatSelection::PreferCondaWithWhl)
.execute()
.await?;There was a problem hiding this comment.
I agree that a follow up PR would be good. Should we change the type to PreferConda for now and then users can still pass in solve_with_sparse_repodata(..., PREFER_CONDA_WITH_WHL)?
eee59e6 to
99efaba
Compare
|
This already looks really good, but I'd be curious to see if there are performance gaps between the two implementations. Did you benchmark any of this? |
I did some quick benchmarks in the conda-rattler-solver context. Results are here conda/conda-rattler-solver#101 (comment). There are some caveat's with these measurements (eg. hyperfine is just measuring how long it takes to run a command, the measurement includes much more than just the solve time, results will vary between machines, etc.). These results suggest that using this pr is <1s faster for a large package like I wrote some quick pytest benchmarks. They show the opposite result, that This difference doesn't inspire much confidence. I'd be interested to run pytest benchmark style test on some more realistic size solve. |
|
Ok, I've added one more test to my little benchmarks branch. It addiitonally compares using @baszalmstra does this investigation resolve your questions around performance gaps? |
|
@soapy1 Looking at your benchmarks I think a 1.5x slowdown is still significant. I think we should be able to improve this significantly. When using channels directly internally the repodata gateway also just use a sparse repodata. Given that you already provide it a sparse repodata should therefor be very fast. |
99efaba to
e0428b4
Compare
|
Details |
| Custom(Arc<dyn RepoDataSource>), | ||
|
|
||
| /// A sparse repodata source (provides records for requested platforms from sparse repodata). | ||
| SparseRepoData(Arc<SparseRepoData>), |
There was a problem hiding this comment.
looks like this is a breaking change that can be avoided by adding #[non_exhaustive]. I think we probably don't want to add that, because every case should always proabably be handled. But not sure if that's the rust way?
|
@baszalmstra, I've updated this pr to add sparse repodata as source for the gateway. I've also updated the benchmark notes https://github.com/soapy1/rattler/pull/. The benchmarks are still pretty jittery, like each run has pretty different results. So, looking to make a few improvements there too. |
Description
This change introduces the ability to pass sparse repodata to the
rattler.solvefunction. This change moves towards unifying the py-rattler solve apis (solveandsolve_with_sparse_repodata).How Has This Been Tested?
rattler.solvefuncitonwith the sample sparse repodata file called `./sparse_repodata.json`
``` { "repodata_version": 2, "info": { "subdir": "noarch", "repodata_revisions": { "v3": {} }, "base_url": "http://127.0.0.1:40093/noarch" }, "packages": {}, "packages.conda": { "foo-1-0_a.conda": { "name": "foo", "version": "1", "build": "0_a", "build_number": 0, "depends": [ "bar" ], "constrains": [ "splat<3" ], "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" }, "bar-1-0_a.conda": { "name": "bar", "version": "1", "build": "0_a", "build_number": 0, "depends": [], "constrains": [ "splat<3" ], "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" } }, "v3": { "tar.bz2": {}, "conda": {}, "whl": {} } }```produces the result:
AI Disclosure
Tools: Claude
Checklist: