Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

r4victor
Copy link
Collaborator

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 introduces ComputeWithAllOffersCached 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 via ComputeWithFilteredOffersCached.

Upsides:

Downsides:

  • When cache is cold, requesting offers may be slower since backend salways collect all offers. In my testing, I observed 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.

r4victor and others added 23 commits September 10, 2025 10:56
…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]>
@r4victor r4victor requested a review from jvstme September 11, 2025 11:20

class {{ backend_name }}Compute(
# TODO: Choose ComputeWith* classes to extend and implement
# ComputeWithAllOffersCached,
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

@r4victor r4victor merged commit 90fc7c9 into master Sep 15, 2025
28 checks passed
@r4victor r4victor deleted the pr_offers_with_availability_cache branch September 15, 2025 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants