Skip to content

profiles.yml

Sometimes, you may want to reuse the same parameters across different .dstack.yml configurations.

This can be achieved by defining those parameters in a profile.

Profiles can be defined on the repository level (via the .dstack/profiles.yml file in the root directory of the 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.

Example

profiles:
  - name: my-profile

    # The spot pololicy can be "spot", "on-demand", or "auto"
    spot_policy: auto

    # Limit the maximum price of the instance per hour
    max_price: 1.5

    # Stop any run if it runs longer that this duration
    max_duration: 1d

    # Use only these backends
    backends: [azure, lambda]

    # If set to true, this profile will be applied automatically
    default: true

The profile configuration supports many properties. See below.

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.