-
Notifications
You must be signed in to change notification settings - Fork 197
Implement requirements-independent offers cache #3091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…rements Co-authored-by: aider (bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0) <[email protected]>
…vation handling Co-authored-by: aider (bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0) <[email protected]>
Co-authored-by: aider (bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0) <[email protected]>
Co-authored-by: aider (bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0) <[email protected]>
Co-authored-by: aider (bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0) <[email protected]>
Co-authored-by: aider (bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0) <[email protected]>
…rs method Co-authored-by: aider (bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0) <[email protected]>
|
||
class {{ backend_name }}Compute( | ||
# TODO: Choose ComputeWith* classes to extend and implement | ||
# ComputeWithAllOffersCached, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My idea is to drop ComputeWithFilteredOffersCached soon – all providers should implement requirements-independent cache.
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 introducesComputeWithAllOffersCached
class 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 offer
anddstack apply
become quick even when called with different requirements consequently.Downsides:
time dstack apply -b aws --gpu H100
goes from ~15s to ~20s,time dstack apply -b gcp --gpu H100
goes 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.