You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contributing/BACKENDS.md
+15-10Lines changed: 15 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,23 +78,23 @@ Once the cloud provider is added, submit a pull request.
78
78
Once the provider is added to `gpuhunt`, we can proceed with implementing
79
79
the corresponding backend with `dstack`. Follow the steps below.
80
80
81
-
####2.1. Determine if you will implement a VM-based or a container-based backend
81
+
### 2.1. Determine if you will implement a VM-based or a container-based backend
82
82
83
83
See the Appendix at the end of this document and make sure the provider meets the outlined requirements.
84
84
85
-
####2.2. Set up the development environment
85
+
### 2.2. Set up the development environment
86
86
87
87
Follow [DEVELOPMENT.md](DEVELOPMENT.md).
88
88
89
-
####2.3. Add dependencies to setup.py
89
+
### 2.3. Add dependencies to setup.py
90
90
91
91
Add any dependencies required by your cloud provider to `setup.py`. Create a separate section with the provider's name for these dependencies, and ensure that you update the `all` section to include them as well.
92
92
93
-
####2.4. Add a new backend type
93
+
### 2.4. Add a new backend type
94
94
95
95
Add a new enumeration member for your provider to `BackendType` ([`src/dstack/_internal/core/models/backends/base.py`](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/models/backends/base.py)).
96
96
97
-
####2.5. Create backend files and classes
97
+
### 2.5. Create backend files and classes
98
98
99
99
`dstack` provides a helper script to generate all the necessary files and classes for a new backend.
100
100
To add a new backend named `ExampleXYZ`, you should run:
@@ -110,7 +110,7 @@ It will create an `examplexyz` backend directory under `src/dstack/_internal/cor
110
110
*`configurator.py` with the `Configurator` class implementation. It deals with validating and storing backend config. You need to adjust it with custom backend config validation.
111
111
*`models.py` with all the backend config models used by `Backend`, `Compute`, `Configurator` and other parts of `dstack`.
112
112
113
-
#####2.6. Adjust and register the backend config models
113
+
### 2.6. Adjust and register the backend config models
114
114
115
115
Go to `models.py`. It'll contain two config models required for all backends:
[azure](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/models.py), etc.
132
132
133
-
#####2.7. Implement the backend compute class
133
+
### 2.7. Implement the backend compute class
134
134
135
135
Go to `compute.py` and implement `Compute` methods.
136
136
Optionally, extend and implement `ComputeWith*` classes to support additional features such as fleets, volumes, gateways, placement groups, etc. For example, extend `ComputeWithCreateInstanceSupport` to support fleets.
[azure](https://github.com/dstackai/dstack/blob/master/src/dstack/_internal/core/backends/azure/compute.py), etc.
143
143
144
-
#####2.8. Implement and register the configurator class
144
+
### 2.8. Implement and register the configurator class
145
145
146
146
Go to `configurator.py` and implement custom `Configurator` logic. At minimum, you should implement creds validation.
147
147
You may also need to validate other config parameters if there are any.
@@ -153,14 +153,19 @@ Refer to examples: [datacrunch](https://github.com/dstackai/dstack/blob/master/s
153
153
154
154
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).
0 commit comments