Workspace Policies
This topic describes APIs to list, retrieve, and update workspace policies.
List Workspace Policies
Use this API to get all workspace policies that are defined in a workspace.
Method and URL
/api/v1/workspace-policies
Parameters
Response Parameters
| Parameter | Parameter Type | Description |
|---|---|---|
| workspaceName | String | The name of the workspace associated with the policy. |
| PriorityRange | String | The priority range configuration for the workspace. |
| maxGPRs | Integer | The maximum number of GPU pod requests allowed. |
| maxExitDurationPerGPR | String | The maximum exit duration per GPU pod request. |
| requeueOnFailure | Boolean | This is the parameter to requeue requests on failure. |
| enableAutoEviction | Boolean | This is the parameter to enable auto eviction for the workspace. |
| globalGPUConstraints | Object | The global GPU constraints configuration. |
| globalGPUConstraints.gpuShapes | Array of Strings] | The list of allowed GPU shapes. |
| globalGPUConstraints.maxGPUPerGpr | Integer | The maximum GPUs per GPU Pod Request. |
| globalGPUConstraints.maxMemoryPerGpr | Integer | The maximum memory per GPU Pod Request (in bytes or MB). |
Example Request
GET /api/v1/workspace-policies
Example Response
Example Responses: Success
{
"statusCode": 200,
"status": "OK",
"message": "Success",
"data": [
{
"workspaceName": "workspace-1",
"PriorityRange": "100-200",
"maxGPRs": 10,
"maxExitDurationPerGPR": "1h",
"requeueOnFailure": true,
"enableAutoEviction": false,
"globalGPUConstraints": {
"gpuShapes": ["NVIDIA-A100", "NVIDIA-V100"],
"maxGPUPerGpr": 4,
"maxMemoryPerGpr": 64
}
},
{
"workspaceName": "workspace-2",
"PriorityRange": "200-300",
"maxGPRs": 5,
"maxExitDurationPerGPR": "2h",
"requeueOnFailure": false,
"enableAutoEviction": true,
"globalGPUConstraints": {
"gpuShapes": ["NVIDIA-T4"],
"maxGPUPerGpr": 2,
"maxMemoryPerGpr": 32
}
}
]
}
Example: Error
{
"statusCode": 500,
"status": "Error",
"message": "Internal Server Error",
"data": null,
"error": {
"errorKey": "UPSTREAM_REQUEST_ERROR",
"message": "Failed to fetch workspace policies",
"data": "{\"error\":{\"Message\":\"Error retrieving workspace policies\",\"Status\":500,\"DetailedError\":{\"Errormessage\":\"API gateway timeout\",\"Reason\":\"InternalError\",\"Details\":\"\"},\"StatusCode\":500}}"
}
}
List Workspace Policy
Use this API to get a required Workspace Policy.
Method and URL
GET /api/v1/workspace-policies/{policyName}
Change {policyName} to the actual name of the policy you want to retrieve.
Parameters
Response Parameters
| Parameter | Parameter Type | Description |
|---|---|---|
| workspaceName | String | The name of the workspace associated with the policy. |
| PriorityRange | String | The priority range configuration for the workspace. |
| maxGPRs | Integer | The maximum number of GPU Pod Requests allowed. |
| maxExitDurationPerGPR | String | The maximum exit duration per GPU Pod Request. |
| requeueOnFailure | Boolean | This parameter is to enable requeue requests on failure. |
| enableAutoEviction | Boolean | This parameter is to enable auto eviction for the workspace. |
| globalGPUConstraints | Object | The global GPU constraints configuration. |
| globalGPUConstraints.gpuShapes | Array[string] | The list of allowed GPU shapes. |
| globalGPUConstraints.maxGPUPerGpr | Integer | The maximum GPUs per GPU Pod Request. |
| globalGPUConstraints.maxMemoryPerGpr | Integer | The maximum memory per GPU Pod Request (in bytes or MB). |
Example Request
GET /api/v1/workspace-policies/workspace-1
Example Responses
Example Response: Success
{
"statusCode": 200,
"status": "OK",
"message": "Success",
"data": {
"workspaceName": "workspace-1",
"PriorityRange": "100-200",
"maxGPRs": 10,
"maxExitDurationPerGPR": "1h",
"requeueOnFailure": true,
"enableAutoEviction": false,
"globalGPUConstraints": {
"gpuShapes": ["NVIDIA-A100", "NVIDIA-V100"],
"maxGPUPerGpr": 4,
"maxMemoryPerGpr": 64
}
}
}
Example Response: Error
{
"statusCode": 404,
"status": "NOT_FOUND",
"message": "Workspace policy not found",
"data": null,
"error": {
"errorKey": "UPSTREAM_REQUEST_ERROR",
"message": "Workspace policy 'workspace-1' not found",
"data": "{\"error\":{\"Message\":\"Policy not found\",\"Status\":404,\"DetailedError\":{\"Errormessage\":\"No policy found with name workspace-1\",\"Reason\":\"NotFound\",\"Details\":\"\"},\"StatusCode\":404}}"
}
}
Update Workspace Policy
Use this API to update a Workspace Policy.
Method and URL
PUT /api/v1/workspace-policies/{policyName}
Change {policyName} to the actual name of the policy you want to update.
Parameters
| Parameter | Parameter Type | Description | Required |
|---|---|---|---|
| policyName | String | The name of the workspace policy you want to update. | Mandatory |
| priorityRange | String | The priority range configuration for the workspace. | Optional |
| maxGPRs | Integer | The maximum number of GPU Pod Requests allowed. | Optional |
| maxExitDurationPerGPR | String | The maximum exit duration per GPU Pod Request. | Optional |
| enforceIdleTimeOut | Boolean | The parameter to enforce idle timeout for GPU Pod Requests. | Optional |
| requeueOnFailure | Boolean | The parameter to requeue requests on failure. | Optional |
| enableAutoEviction | Boolean | The parameter to enable auto eviction for the workspace. | Optional |
| gpuShapes | Array[string] | The list of allowed GPU shapes. | Optional |
| maxGpuPerGpr | Integer | The maximum GPUs per GPU Pod Request. | Optional |
| maxMemoryPerGpr | Integer | The maximum memory per GPU Pod Request (in bytes or MB). | Optional |
Example Request
{
"priorityRange": "150-250",
"maxGPRs": 15,
"requeueOnFailure": false,
"gpuShapes": ["NVIDIA-A100"],
"maxGpuPerGpr": 8,
"maxMemoryPerGpr": 128
}
Example Responses
Example Response: Success
{
"statusCode": 200,
"status": "OK",
"message": "Success",
"data": {
"workspaceName": "workspace-1",
"PriorityRange": "150-250",
"maxGPRs": 15,
"maxExitDurationPerGPR": "1h",
"requeueOnFailure": false,
"enableAutoEviction": false,
"globalGPUConstraints": {
"gpuShapes": ["NVIDIA-A100"],
"maxGPUPerGpr": 8,
"maxMemoryPerGpr": 128
}
}
}
Example Response: Bad Request
{
"statusCode": 400,
"status": "INVALID_REQUEST",
"message": "At least one field must be provided for update",
"data": null,
"error": {
"errorKey": "INVALID_REQUEST",
"message": "At least one field must be provided for update",
"data": null
}
}
Example Response: Not Found
{
"statusCode": 404,
"status": "NOT_FOUND",
"message": "Workspace policy not found",
"data": null,
"error": {
"errorKey": "UPSTREAM_REQUEST_ERROR",
"message": "Workspace policy 'workspace-1' not found",
"data": "{\"error\":{\"Message\":\"Policy not found\",\"Status\":404,\"DetailedError\":{\"Errormessage\":\"No policy found with name workspace-1\",\"Reason\":\"NotFound\",\"Details\":\"\"},\"StatusCode\":404}}"
}
}
Example Response: Internal Server Error
{
"statusCode": 500,
"status": "Error",
"message": "Internal Server Error",
"data": null,
"error": {
"errorKey": "UPSTREAM_REQUEST_ERROR",
"message": "Failed to update workspace policy",
"data": "{\"error\":{\"Message\":\"Error updating workspace policy\",\"Status\":500,\"DetailedError\":{\"Errormessage\":\"API gateway timeout\",\"Reason\":\"InternalError\",\"Details\":\"\"},\"StatusCode\":500}}"
}
}