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: docs/admin/workloads/policies.md
+33-9Lines changed: 33 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Policies allow administrators to _impose restrictions_ and set _default values_
6
6
7
7
1. Restrict researchers from requesting more than 2 GPUs, or less than 1GB of memory for an interactive workload.
8
8
2. Set the default memory of each training job to 1GB, or mount a default volume to be used by any submitted Workload.
9
-
9
+
10
10
Policies are stored as Kubernetes [custom resources](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources){default=_blank}.
11
11
12
12
Policies are specific to Workload type as such there are several kinds of Policies:
@@ -15,7 +15,7 @@ Policies are specific to Workload type as such there are several kinds of Polici
A Policy can be created per Run:ai Project (Kubernetes namespace). Additionally, a Policy resource can be created in the `runai` namespace. This special Policy will take effect when there is no project-specific Policy for the relevant workload kind.
@@ -51,19 +51,43 @@ The policy places a default and limit on the available values for GPU allocation
51
51
```bash
52
52
kubectl apply -f gpupolicy.yaml
53
53
```
54
+
54
55
Now, try the following command:
56
+
55
57
```bash
56
58
runai submit --gpu 5 --interactive -p team-a
57
59
```
60
+
58
61
The following message will appear:
62
+
59
63
```
60
64
gpu: must be no greater than 4
61
65
```
62
-
A similar message will appear in the _New Job_ form of the Run:ai user interface, when attempting to enter the number of GPUs, which is out of range for an Interactive tab.
66
+
67
+
A similar message will appear in the _New Job_ form of the Run:ai user interface, when attempting to enter the number of GPUs, which is out of range for a training job.
68
+
69
+
The following policy places a default and limit on the available values for CPU and GPU memory allocation.
70
+
71
+
```YAML title="gpumemorypolicy.yaml"
72
+
apiVersion: run.ai/v2alpha1
73
+
kind: TrainingPolicy
74
+
metadata:
75
+
name: training-policy
76
+
namespace: runai
77
+
spec:
78
+
gpuMemory:
79
+
rules:
80
+
min: 100M
81
+
max: 2G
82
+
memory:
83
+
rules:
84
+
min: 100M
85
+
max: 2G
86
+
```
63
87
64
88
## Read-only values
65
89
66
-
When you do not want the user to be able to change a value, you can force the corresponding user interface control to become read-only by using the `canEdit` key. For example,
90
+
When you do not want the user to be able to change a value, you can force the corresponding user interface control to become read-only by using the `canEdit` key. For example,
67
91
68
92
``` YAML title="runasuserpolicy.yaml"
69
93
apiVersion: run.ai/v2alpha1
@@ -82,15 +106,15 @@ spec:
82
106
```
83
107
84
108
1. Set the Project namespace here.
85
-
2. The field is required.
86
-
3. The field will be shown as read-only in the user interface.
109
+
2. The field is required.
110
+
3. The field will be shown as read-only in the user interface.
87
111
4. The field value is true.
88
112
89
113
### Complex Values
90
114
91
-
The example above illustrated rules for parameters of "primitive" types, such as _GPU allocation_, _CPU memory_, _working directory_, etc. These parameters contain a single value.
115
+
The example above illustrated rules for parameters of "primitive" types, such as _GPU allocation_, _CPU memory_, _working directory_, etc. These parameters contain a single value.
92
116
93
-
Other workload parameters, such as _ports_ or _volumes_, are "complex", in the sense that they may contain multiple values: a workload may contain multiple ports and multiple volumes.
117
+
Other workload parameters, such as _ports_ or _volumes_, are "complex", in the sense that they may contain multiple values: a workload may contain multiple ports and multiple volumes.
94
118
95
119
The following is an example of a policy containing the value `ports`, which is complex: The `ports` flag typically contains two values: The `external` port that is mapped to an internal `container` port. One can have multiple port tuples defined for a single Workload:
96
120
@@ -235,7 +259,7 @@ FIELDS:
235
259
if the map as a whole is required
236
260
```
237
261
238
-
Note that each kind of policy has a slightly different set of parameters. For example, an `InteractivePolicy` has a `jupyter` parameter that is not available under `TrainingPolicy`.
262
+
Note that each kind of policy has a slightly different set of parameters. For example, an `InteractivePolicy` has a `jupyter` parameter that is not available under `TrainingPolicy`.
0 commit comments