Skip to content

Commit 1e9a8bf

Browse files
committed
Update docs
1 parent 41d57ce commit 1e9a8bf

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

contributing/BACKENDS.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ git clone https://github.com/dstackai/gpuhunt.git
2727

2828
- **Offline providers** offer static machine configurations that are not frequently updated.
2929
`gpuhunt` collects offline providers' instance offers on an hourly basis.
30-
Examples: `aws`, `gcp`, `azure`, etc.
30+
Examples: `aws`, `gcp`, `azure`, etc.
3131
- **Online providers** offer dynamic machine configurations that are available at the very moment
3232
when you fetch configurations (e.g., GPU marketplaces).
3333
`gpuhunt` collects online providers' instance offers each time a `dstack` user provisions a new instance.
3434
Examples: `tensordock`, `vastai`, etc.
3535

3636
### 1.3. Create the provider class
3737

38-
Create the provider class file under `src/gpuhunt/providers`.
38+
Create the provider class file under `src/gpuhunt/providers`.
3939

4040
Make sure your class extends the [`AbstractProvider`](https://github.com/dstackai/gpuhunt/blob/main/src/gpuhunt/providers/__init__.py)
4141
base class. See its docstrings for descriptions of the methods that your class should implement.
@@ -69,13 +69,13 @@ Refer to examples: [test_datacrunch.py](https://github.com/dstackai/gpuhunt/blob
6969

7070
### 1.6. Submit a pull request
7171

72-
Once the cloud provider is added, submit a pull request.
72+
Once the cloud provider is added, submit a pull request.
7373

7474
> Anything unclear? Ask questions on the [Discord server](https://discord.gg/u8SmfwPpMd).
7575
7676
## 2. Integrate the cloud provider to dstackai/dstack
7777

78-
Once the provider is added to `gpuhunt`, we can proceed with implementing
78+
Once the provider is added to `gpuhunt`, we can proceed with implementing
7979
the corresponding backend with `dstack`. Follow the steps below.
8080

8181
### 2.1. Determine if you will implement a VM-based or a container-based backend
@@ -124,10 +124,10 @@ Then add these models to `AnyBackendConfig*` unions in [`src/dstack/_internal/co
124124

125125
The script also generates `*BackendStoredConfig` that extends `*BackendConfig` to be able to store extra parameters in the DB. By the same logic, it generates `*Config` that extends `*BackendStoredConfig` with creds and uses it as the main `Backend` and `Compute` config instead of using `*BackendConfigWithCreds` directly.
126126

127-
Refer to examples:
128-
[datacrunch](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/datacrunch/models.py),
129-
[aws](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/aws/models.py),
130-
[gcp](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/gcp/models.py),
127+
Refer to examples:
128+
[datacrunch](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/datacrunch/models.py),
129+
[aws](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/aws/models.py),
130+
[gcp](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/gcp/models.py),
131131
[azure](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/models.py), etc.
132132

133133
### 2.7. Implement the backend compute class
@@ -147,8 +147,8 @@ Go to `configurator.py` and implement custom `Configurator` logic. At minimum, y
147147
You may also need to validate other config parameters if there are any.
148148

149149
Refer to examples: [datacrunch](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/datacrunch/configurator.py),
150-
[aws](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/aws/configurator.py),
151-
[gcp](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/gcp/configurator.py),
150+
[aws](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/aws/configurator.py),
151+
[gcp](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/gcp/configurator.py),
152152
[azure](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/azure/configurator.py), etc.
153153

154154
Register configurator by appending it to `_CONFIGURATOR_CLASSES` in [`src/dstack/_internal/core/backends/configurators.py`](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/configurators.py).
@@ -181,6 +181,9 @@ The agent controls the VM and starts Docker containers for users' jobs.
181181
Since `dstack` controls the entire VM, VM-based backends can support more features,
182182
such as blocks, instance volumes, privileged containers, and reusable instances.
183183

184+
Note, all VM-based backend `Compute`s should sublass the `ComputeWithPrivilegedSupport` mixin,
185+
as the `dstack-shim` agent provides this functionality OOTB.
186+
184187
To support a VM-based backend, `dstack` expects the following:
185188

186189
- An API for creating and terminating VMs

src/dstack/_internal/core/backends/base/compute.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ def _restrict_instance_offer_az_to_volumes_az(
323323
class ComputeWithPrivilegedSupport:
324324
"""
325325
Must be subclassed to support runs with `privileged: true`.
326+
All VM-based Computes (that is, Computes that use the shim) should subclass this mixin.
326327
"""
327328

328329
pass

0 commit comments

Comments
 (0)