diff --git a/docs/docs/reference/profiles.yml.md b/docs/docs/reference/profiles.yml.md index a6c7a4990..c245f245c 100644 --- a/docs/docs/reference/profiles.yml.md +++ b/docs/docs/reference/profiles.yml.md @@ -8,7 +8,7 @@ Profiles can be defined on the repository level (via the `.dstack/profiles.yml` repository) or on the global level (via the `~/.dstack/profiles.yml` file). Any profile can be marked as default so that it will be applied automatically for any run. Otherwise, you can refer to a specific profile -via `--profile NAME` in `dstack run`. +via `--profile NAME` in `dstack apply`. ### Example diff --git a/examples/deployment/ollama/README.md b/examples/deployment/ollama/README.md index 5c72aebfe..7bb833da2 100644 --- a/examples/deployment/ollama/README.md +++ b/examples/deployment/ollama/README.md @@ -3,7 +3,7 @@ The following command deploys Mixtral 8x7B as a service: ```shell -dstack run . -f examples/deployment/ollama/serve.dstack.yml +dstack apply . -f examples/deployment/ollama/serve.dstack.yml ``` See the configuration at [serve.dstack.yml](serve.dstack.yml). diff --git a/examples/fine-tuning/alignment-handbook/README.md b/examples/fine-tuning/alignment-handbook/README.md index 9842cb4c4..a74a20b9c 100644 --- a/examples/fine-tuning/alignment-handbook/README.md +++ b/examples/fine-tuning/alignment-handbook/README.md @@ -150,7 +150,7 @@ Here's how the multi-node task is different from the single-node one: ## Fleets -> By default, `dstack run` reuses `idle` instances from one of the existing [fleets](https://dstack.ai/docs/fleets). +> By default, `dstack apply` reuses `idle` instances from one of the existing [fleets](https://dstack.ai/docs/fleets). If no `idle` instances meet the requirements, it creates a new fleet using one of the configured backends. The example folder includes two cloud fleet configurations: [`examples/fine-tuning/alignment-handbook/fleet.dstack.yml`](https://github.com/dstackai/dstack/blob/master/examples/fine-tuning/alignment-handbook/fleet.dstack.yml) (a single node with a `24GB` GPU), diff --git a/examples/fine-tuning/trl/README.md b/examples/fine-tuning/trl/README.md index 142cb46d3..26d91b7d0 100644 --- a/examples/fine-tuning/trl/README.md +++ b/examples/fine-tuning/trl/README.md @@ -164,7 +164,7 @@ resources: ## Fleets -By default, `dstack run` reuses `idle` instances from one of the existing [fleets](https://dstack.ai/docs/fleets). +By default, `dstack apply` reuses `idle` instances from one of the existing [fleets](https://dstack.ai/docs/fleets). If no `idle` instances meet the requirements, it creates a new fleet using one of the configured backends. Use [fleets](https://dstack.ai/docs/fleets.md) configurations to create fleets manually. This reduces startup time for dev environments, diff --git a/runner/README.md b/runner/README.md index d1c218ac4..4cb175433 100644 --- a/runner/README.md +++ b/runner/README.md @@ -49,7 +49,7 @@ DSTACK_LOCAL_BACKEND_ENABLED= dstack server --log-level=debug The `local` backend will submit the run to the locally started shim and runner. The CLI will attach to the container just as if it were any other cloud backend: ```shell -✗ dstack run . +✗ dstack apply . Configuration .dstack.yml Project main User admin diff --git a/src/dstack/_internal/cli/commands/run.py b/src/dstack/_internal/cli/commands/run.py deleted file mode 100644 index 865fdea9e..000000000 --- a/src/dstack/_internal/cli/commands/run.py +++ /dev/null @@ -1,75 +0,0 @@ -import argparse -from pathlib import Path - -from dstack._internal.cli.commands import APIBaseCommand -from dstack._internal.cli.services.configurators import get_run_configurator_class -from dstack._internal.cli.services.configurators.run import BaseRunConfigurator -from dstack._internal.core.models.configurations import RunConfigurationType -from dstack._internal.utils.logging import get_logger -from dstack.api.utils import load_configuration - -logger = get_logger(__name__) -NOTSET = object() - - -class RunCommand(APIBaseCommand): - NAME = "run" - DESCRIPTION = "Run a configuration" - DEFAULT_HELP = False - - def _register(self): - super()._register() - self._parser.add_argument( - "-h", - "--help", - nargs="?", - type=RunConfigurationType, - default=NOTSET, - help="Show this help message and exit. TYPE is one of [code]task[/], [code]dev-environment[/], [code]service[/]", - dest="help", - metavar="TYPE", - ) - self._parser.add_argument("working_dir") - self._parser.add_argument( - "-f", - "--file", - type=Path, - metavar="FILE", - help="The path to the configuration file. Defaults to [code]$PWD/.dstack.yml[/]", - dest="configuration_file", - ) - self._parser.add_argument( - "-y", - "--yes", - help="Do not ask for confirmation", - action="store_true", - ) - - def _command(self, args: argparse.Namespace): - if args.help is not NOTSET: - if args.help is not None: - configurator_class = get_run_configurator_class(RunConfigurationType(args.help)) - else: - configurator_class = BaseRunConfigurator - configurator_class.register_args(self._parser) - self._parser.print_help() - return - - super()._command(args) - - logger.warning("[code]dstack run[/] is deprecated in favor of [code]dstack apply[/].") - - configuration_path, configuration = load_configuration( - Path.cwd(), configuration_file=args.configuration_file - ) - configurator_class = get_run_configurator_class(configuration.type) - configurator = configurator_class(api_client=self.api) - configurator_parser = configurator.get_parser() - known, unknown = configurator_parser.parse_known_args(args.unknown) - configurator.apply_configuration( - conf=configuration, - configuration_path=configuration_path, - command_args=args, - configurator_args=known, - unknown_args=unknown, - ) diff --git a/src/dstack/_internal/cli/main.py b/src/dstack/_internal/cli/main.py index fe56a4483..984395f1f 100644 --- a/src/dstack/_internal/cli/main.py +++ b/src/dstack/_internal/cli/main.py @@ -14,7 +14,6 @@ from dstack._internal.cli.commands.init import InitCommand from dstack._internal.cli.commands.logs import LogsCommand from dstack._internal.cli.commands.ps import PsCommand -from dstack._internal.cli.commands.run import RunCommand from dstack._internal.cli.commands.server import ServerCommand from dstack._internal.cli.commands.stats import StatsCommand from dstack._internal.cli.commands.stop import StopCommand @@ -39,7 +38,7 @@ def main(): parser = argparse.ArgumentParser( description=( "Not sure where to start? Call [code]dstack init[/].\n" - "Define a [code].dstack.yml[/] configuration file and run it via [code]dstack run[/]\n" + "Define a [code].dstack.yml[/] configuration file and run it via [code]dstack apply[/]\n" ), formatter_class=RichHelpFormatter, epilog=( @@ -67,7 +66,6 @@ def main(): InitCommand.register(subparsers) LogsCommand.register(subparsers) PsCommand.register(subparsers) - RunCommand.register(subparsers) ServerCommand.register(subparsers) StatsCommand.register(subparsers) StopCommand.register(subparsers) diff --git a/src/dstack/_internal/core/models/profiles.py b/src/dstack/_internal/core/models/profiles.py index 630c26baa..43faf412f 100644 --- a/src/dstack/_internal/core/models/profiles.py +++ b/src/dstack/_internal/core/models/profiles.py @@ -270,11 +270,11 @@ class ProfileProps(CoreModel): name: Annotated[ str, Field( - description="The name of the profile that can be passed as `--profile` to `dstack run`" + description="The name of the profile that can be passed as `--profile` to `dstack apply`" ), ] default: Annotated[ - bool, Field(description="If set to true, `dstack run` will use this profile by default.") + bool, Field(description="If set to true, `dstack apply` will use this profile by default.") ] = False