Implement requirements-independent offers cache#3091
Merged
Conversation
…rements Co-authored-by: aider (bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0) <aider@aider.chat>
…vation handling Co-authored-by: aider (bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0) <aider@aider.chat>
Co-authored-by: aider (bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0) <aider@aider.chat>
Co-authored-by: aider (bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0) <aider@aider.chat>
Co-authored-by: aider (bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0) <aider@aider.chat>
Co-authored-by: aider (bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0) <aider@aider.chat>
…rs method Co-authored-by: aider (bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0) <aider@aider.chat>
jvstme
approved these changes
Sep 12, 2025
|
|
||
| class {{ backend_name }}Compute( | ||
| # TODO: Choose ComputeWith* classes to extend and implement | ||
| # ComputeWithAllOffersCached, |
Collaborator
There was a problem hiding this comment.
(nit) I think ComputeWithFilteredOffersCached could be a good default for the template, since it works for all backends. Guidance on how to choose between ComputeWithAllOffersCached and ComputeWithFilteredOffersCached could also be helpful, unless we expect to move away from this model before anyone contributes the next backend.
Collaborator
Author
There was a problem hiding this comment.
My idea is to drop ComputeWithFilteredOffersCached soon – all providers should implement requirements-independent cache.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #3021
This PR reworks how dstack caches backend offers. Common
get_offers_cached()is dropped. For most backends for which offers do not depend on requirements (or offers can be adjusted as in case with disk), it introducesComputeWithAllOffersCachedclass that implements caching of all offers with availability and requirements post-filtering. This allows reusing cache when getting offers for different requirements. For cudo, vastai, kubernetes, the old behavior is preserved viaComputeWithFilteredOffersCached.Upsides:
dstack offeranddstack applybecome quick even when called with different requirements consequently.Downsides:
time dstack apply -b aws --gpu H100goes from ~15s to ~20s,time dstack apply -b gcp --gpu H100goes from ~10s to ~15s.This implementation is for transitioning period. The plan is to experiment with fleet selection logic considering fleet offers, and see if it works well. Then, implement requirements-independent cache for cudo, vastai (requires caching provider's API calls, which currently can be done in gpuhunt only). Then move offers collection into dstack and simplify the code.
Tested offers for all backends except for cloudrift.