Skip to content

Support --fleet in dstack offer#3774

Open
peterschmidt85 wants to merge 9 commits intomasterfrom
fix/offer-fleet-filtering
Open

Support --fleet in dstack offer#3774
peterschmidt85 wants to merge 9 commits intomasterfrom
fix/offer-fleet-filtering

Conversation

@peterschmidt85
Copy link
Copy Markdown
Contributor

@peterschmidt85 peterschmidt85 commented Apr 14, 2026

Summary

  • without --fleet, dstack offer ignores existing fleets and shows all available offers that match the request
  • with one --fleet, dstack offer shows the offers available through that fleet
  • with multiple --fleet, dstack offer combines the offers available through the selected fleets
  • identical backend offers found through multiple selected fleets are shown once
  • matching existing instances are still shown separately
  • dstack offer --group-by ... --fleet ... follows the same fleet-selection behavior for backend offers
  • dstack apply is unchanged and still chooses a single best fleet
  • remove the stale --fleet warning, add a plain-output hint, and document the fleet behavior in SKILL.md

Testing

Validated E2E use cases

  • without --fleet, plain and grouped dstack offer still ignore existing fleets and show all matching available offers
  • with one --fleet, plain, JSON, and grouped dstack offer show the offers available through that fleet
  • with multiple --fleet, dstack offer combines the offers available through the selected fleets and excludes unselected fleets
  • identical backend offers from multiple selected fleets are shown once, while matching existing instances remain separate
  • broad queries with many matching offers keep exact total_offers, including after multi-fleet backend-offer deduplication
  • imported fleets work correctly in both dstack offer and dstack apply
  • dstack apply still chooses a single best fleet and provisions successfully

Checks

  • uv run pytest
  • uv run pyright -p .
  • uv run pre-commit run --files src/dstack/_internal/server/services/runs/plan.py src/tests/_internal/server/routers/test_runs.py src/tests/_internal/server/services/runs/test_plan.py

AI Assistance

  • Assisted by Codex

Keep plain dstack offer global when no fleets are specified, but respect explicitly selected fleets. For a single --fleet, return the same per-fleet offers that would be considered if that fleet were the chosen candidate during apply planning. For multiple --fleet values, collect offers for each selected fleet and merge them instead of picking one best fleet.
@peterschmidt85 peterschmidt85 requested a review from r4victor April 14, 2026 08:53
Inline the temporary dstack offer dispatcher helper, rename the remaining fleet offer helper to match its behavior, and document the single-fleet vs multi-fleet semantics in docstrings.
@peterschmidt85 peterschmidt85 requested review from r4victor and removed request for r4victor April 14, 2026 08:59
Andrey Cheptsov added 2 commits April 14, 2026 11:32
The new offer CLI test helper used asyncio.run(), which clears the current event loop on Python 3.9/3.10 and made a later test_event_loop assertion fail in GitHub Actions. Use a private event loop in the helper instead so the test stays isolated.
Add a short comment explaining why the helper uses a private event loop instead of asyncio.run(): the latter clears the current loop on Python 3.9/3.10 and can break later tests in the same worker.
The isolated-loop comment should not claim the same Queue construction failure on Python 3.10. Python 3.9 still constructs Queue via get_event_loop(), while 3.10 removed the loop parameter and defers loop binding until use.
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