Skip to content

Commit 0d781bc

Browse files
committed
Show warning when using autocreated fleets
1 parent ebd0f06 commit 0d781bc

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

  • src/dstack/_internal/cli/services/configurators

src/dstack/_internal/cli/services/configurators/run.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
from dstack._internal.utils.path import is_absolute_posix_path
5858
from dstack.api._public.repos import get_ssh_keypair
5959
from dstack.api._public.runs import Run
60+
from dstack.api.server import APIClient
6061
from dstack.api.utils import load_profile
6162

6263
_KNOWN_AMD_GPUS = {gpu.name.lower() for gpu in gpuhunt.KNOWN_AMD_GPUS}
@@ -222,6 +223,9 @@ def apply_configuration(
222223
format_date=local_time,
223224
)
224225
)
226+
227+
_warn_fleet_autocreated(self.api.client, run)
228+
225229
console.print(
226230
f"\n[code]{run.name}[/] provisioning completed [secondary]({run.status.value})[/]"
227231
)
@@ -865,3 +869,17 @@ def render_run_spec_diff(old_spec: RunSpec, new_spec: RunSpec) -> Optional[str]:
865869
item = NestedListItem(spec_field.replace("_", " ").capitalize())
866870
nested_list.children.append(item)
867871
return nested_list.render()
872+
873+
874+
def _warn_fleet_autocreated(api: APIClient, run: Run):
875+
if run._run.fleet is None:
876+
return
877+
fleet = api.fleets.get(project_name=run._project, name=run._run.fleet.name)
878+
if not fleet.spec.autocreated:
879+
return
880+
warn(
881+
f"\nThe run is using automatically created fleet [code]{fleet.name}[/code].\n"
882+
"Future [code]dstack[/code] versions will stop creating fleets automatically.\n"
883+
"Create the fleet explicitly to remove this warning and prepare for upcoming changes.\n"
884+
"Learn more about fleets: https://dstack.ai/docs/concepts/fleets/"
885+
)

0 commit comments

Comments
 (0)