Skip to content

Conversation

@r4victor
Copy link
Collaborator

@r4victor r4victor commented Feb 6, 2025

The PR:

  • Adds -n/--name to dstack apply for all configuration types. This is primarily relevant for [Feature]: Support per-job volumes #2264 so that it becomes easy to create many volumes using a one liner: for i in {0..7}; do dstack apply -f .dstack/confs/volume.yaml -n data-volume-$i -y; done.
  • Improves dstack apply -h output: a hint to pass configuration type. If a configuration type is specified, prints configuration-specific options in a separate argument group:
dstack apply -h
Usage: dstack apply [--project NAME] [-h [TYPE]] [-f FILE] [-y] [--force] [-d]
                    [-P REPO] [--repo-branch REPO_BRANCH] [--repo-hash REPO_HASH]
                    [--no-repo] [-t OAUTH_TOKEN] [--git-identity SSH_PRIVATE_KEY]
                    [--ssh-identity SSH_PRIVATE_KEY] [--local]

Options:
  --project NAME        The name of the project. Defaults to $DSTACK_PROJECT
  -h, --help [TYPE]     Show this help message and exit.
  -f, --file FILE       The path to the configuration file. Defaults to
                        $PWD/.dstack.yml
  -y, --yes             Do not ask for confirmation
  --force               Force apply when no changes detected
  -d, --detach          Exit immediately after sumbitting configuration

Repo Options:
  -P, --repo REPO       The repo to use for the run. Can be a local path or a Git
                        repo URL.
  --repo-branch REPO_BRANCH
                        The repo branch to use for the run
  --repo-hash REPO_HASH
                        The hash of the repo commit to use for the run
  --no-repo             Do not use any repo for the run
  -t, --token OAUTH_TOKEN
                        An authentication token to access a private Git repo
  --git-identity SSH_PRIVATE_KEY
                        The private SSH key path to access a private Git repo
  --ssh-identity SSH_PRIVATE_KEY
                        The private SSH key path for SSH tunneling
  --local               Do not use Git

Type `dstack apply -h CONFIGURATION_TYPE` to see configuration-specific options.
 dstack apply -h service
Usage: dstack apply [--project NAME] [-h [TYPE]] [-f FILE] [-y] [--force] [-d]
                    [-P REPO] [--repo-branch REPO_BRANCH] [--repo-hash REPO_HASH]
                    [--no-repo] [-t OAUTH_TOKEN] [--git-identity SSH_PRIVATE_KEY]
                    [--ssh-identity SSH_PRIVATE_KEY] [--local] [-n RUN_NAME]
                    [--max-offers MAX_OFFERS] [-e KEY[=VALUE]] [--gpu SPEC]
                    [--disk RANGE] [--profile NAME] [--max-price PRICE]
                    [--max-duration DURATION] [-b NAME] [-r NAME]
                    [--instance-type NAME]
                    [--pool POOL_NAME | -R | --dont-destroy | --idle-duration IDLE_DURATION | --instance NAME]
                    [--spot | --on-demand | --spot-auto | --spot-policy POLICY]
                    [--retry | --no-retry | --retry-duration DURATION]

Options:
  --project NAME        The name of the project. Defaults to $DSTACK_PROJECT
  -h, --help [TYPE]     Show this help message and exit.
  -f, --file FILE       The path to the configuration file. Defaults to
                        $PWD/.dstack.yml
  -y, --yes             Do not ask for confirmation
  --force               Force apply when no changes detected
  -d, --detach          Exit immediately after sumbitting configuration

Repo Options:
  -P, --repo REPO       The repo to use for the run. Can be a local path or a Git
                        repo URL.
  --repo-branch REPO_BRANCH
                        The repo branch to use for the run
  --repo-hash REPO_HASH
                        The hash of the repo commit to use for the run
  --no-repo             Do not use any repo for the run
  -t, --token OAUTH_TOKEN
                        An authentication token to access a private Git repo
  --git-identity SSH_PRIVATE_KEY
                        The private SSH key path to access a private Git repo
  --ssh-identity SSH_PRIVATE_KEY
                        The private SSH key path for SSH tunneling
  --local               Do not use Git

Service Options:
  -n, --name RUN_NAME   The name of the run. If not specified, a random name is
                        assigned
  --max-offers MAX_OFFERS
                        Number of offers to show in the run plan
  -e, --env KEY[=VALUE]
                        Environment variables
  --gpu SPEC            Request GPU for the run. The format is NAME:COUNT:MEMORY
                        (all parts are optional)
  --disk RANGE          Request the size range of disk for the run. Example
                        --disk 100GB...

Profile:
  --profile NAME        The name of the profile. Defaults to $DSTACK_PROFILE
  --max-price PRICE     The maximum price per hour, in dollars
  --max-duration DURATION
                        The maximum duration of the run
  -b, --backend NAME    The backends that will be tried for provisioning
  -r, --region NAME     The regions that will be tried for provisioning
  --instance-type NAME  The cloud-specific instance types that will be tried for
                        provisioning

Pools:
  --pool POOL_NAME      The name of the pool. If not set, the default pool will
                        be used
  -R, --reuse           Reuse instance from pool
  --dont-destroy        Do not destroy instance after the run is finished
  --idle-duration IDLE_DURATION
                        Time to wait before destroying the idle instance
  --instance NAME       Reuse instance from pool with name NAME

Spot Policy:
  --spot                Consider only spot instances
  --on-demand           Consider only on-demand instances
  --spot-auto           Consider both spot and on-demand instances
  --spot-policy POLICY  One of spot, on-demand, auto

Retry Policy:
  --retry
  --no-retry
  --retry-duration DURATION

@r4victor r4victor requested review from jvstme and un-def February 6, 2025 09:27
@r4victor r4victor merged commit db585a8 into master Feb 7, 2025
24 checks passed
@r4victor r4victor deleted the issue_2264_name_via_cli branch February 7, 2025 05:32
pranitnaik43 pushed a commit to bahaal-tech/dstack that referenced this pull request Mar 4, 2025
pranitnaik43 pushed a commit to bahaal-tech/dstack that referenced this pull request Mar 5, 2025
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.

3 participants