Skip to content

Conversation

@r4victor
Copy link
Collaborator

@r4victor r4victor commented Nov 18, 2025

Closes #3294

The PR changes run plan logic to return offers wrt to an optimal fleet. Effectively, run plan offers are now the same as the offers used for provisioning + non-available (e.g. busy, no quota) offers. If there is no suitable fleet for the run, the run plan includes offers across all project backends (as before, to show offers for autocreated fleets flow). If FeatureFlags.DSTACK_FF_AUTOCREATED_FLEETS_DISABLED is set, then no suitable fleet for the run means no offers (future behavior).

There is an extensive refactoring so that the same find_optimal_fleet_with_offers() function is used for getting optimal fleet and its offers both for run plan and during provisioning. Also split services/runs.py into modules since it became too big.

dstack offer command works the same as before returning all offers irrespective of fleets. This case is handled separately when generating run plan offers.

Performance

Getting run plan now involves getting offers for every fleet (to select an optimal fleet), and the time of getting run plan now increases linearly with the number of suitable fleets when offers in cache. For example, with aws+gcp across all regions and 10 fleets, get offers becomes 15-20s from 1.5s-2s.

Peak memory also increases linearly with the number of suitable fleets. With aws+gcp across all regions and 10 fleets, it's ~1.3GB vs 0.5GB with one fleet / before.

A possible time/memory optimization is to limit the number of offers process by a backend so that backends do not need to modify thousands of offers for every fleet to set disk, availability zones, etc. A caveat is that there is post filtering that can filter out all/most of returned offers, and the offers left out by the limit may be needed then.

@r4victor r4victor merged commit f46849e into master Nov 19, 2025
28 checks passed
@r4victor r4victor deleted the issue_3294_plan_offers_wrt_fleets branch November 19, 2025 05:26
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.

[Feature]: Return run plan offers wrt fleets

2 participants