Skip to content

profiles.yml

Instead of configuring run options as dstack run arguments or .dstack.yml parameters, you can defines those options in profiles.yml and reuse them across different run configurations. dstack supports repository-level profiles defined in $REPO_ROOT/.dstack/profiles.yml and global profiles defined in ~/.dstack/profiles.yml.

Profiles parameters are resolved with the following priority:

  1. dstack run arguments
  2. .dstack.yml parameters
  3. Repository-level profiles from $REPO_ROOT/.dstack/profiles.yml
  4. Global profiles from ~/.dstack/profiles.yml

Example

profiles:
  - name: large

    spot_policy: auto # (Optional) The spot policy. Supports `spot`, `on-demand, and `auto`.

    max_price: 1.5 # (Optional) The maximum price per instance per hour

    max_duration: 1d # (Optional) The maximum duration of the run.

    retry:
      retry-duration: 3h # (Optional) To wait for capacity

    backends: [azure, lambda]  # (Optional) Use only listed backends 

    default: true # (Optional) Activate the profile by default

You can mark any profile as default or pass its name via --profile to dstack run.

Root reference

backends - (Optional) The backends to consider for provisionig (e.g., [aws, gcp]).

regions - (Optional) The regions to consider for provisionig (e.g., [eu-west-1, us-west4, westeurope]).

instance_types - (Optional) The cloud-specific instance types to consider for provisionig (e.g., [p3.8xlarge, n1-standard-4]).

spot_policy - (Optional) The policy for provisioning spot or on-demand instances: spot, on-demand, or auto.

retry_policy - (Optional) The policy for re-submitting the run.

max_duration - (Optional) The maximum duration of a run (e.g., 2h, 1d, etc). After it elapses, the run is forced to stop. Defaults to off.

max_price - (Optional) The maximum price per hour, in dollars.

pool_name - (Optional) The name of the pool. If not set, dstack will use the default name.

instance_name - (Optional) The name of the instance.

creation_policy - (Optional) The policy for using instances from the pool. Defaults to reuse-or-create.

termination_policy - (Optional) The policy for termination instances. Defaults to destroy-after-idle.

termination_idle_time - (Optional) Time to wait before destroying the idle instance. Defaults to 5m for dstack run and to 3d for dstack pool add.

name - The name of the profile that can be passed as --profile to dstack run.

default - (Optional) If set to true, dstack run will use this profile by default..

retry_policy

retry - (Optional) Whether to retry the run on failure or not.

duration - (Optional) The maximum period of retrying the run, e.g., 4h or 1d.