Skip to main content
Version: 1.15.0

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

ParameterParameter TypeDescription
workspaceNameStringThe name of the workspace associated with the policy.
PriorityRangeStringThe priority range configuration for the workspace.
maxGPRsIntegerThe maximum number of GPU pod requests allowed.
maxExitDurationPerGPRStringThe maximum exit duration per GPU pod request.
requeueOnFailureBooleanThis is the parameter to requeue requests on failure.
enableAutoEvictionBooleanThis is the parameter to enable auto eviction for the workspace.
globalGPUConstraintsObjectThe global GPU constraints configuration.
globalGPUConstraints.gpuShapesArray of Strings]The list of allowed GPU shapes.
globalGPUConstraints.maxGPUPerGprIntegerThe maximum GPUs per GPU Pod Request.
globalGPUConstraints.maxMemoryPerGprIntegerThe 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

ParameterParameter TypeDescription
workspaceNameStringThe name of the workspace associated with the policy.
PriorityRangeStringThe priority range configuration for the workspace.
maxGPRsIntegerThe maximum number of GPU Pod Requests allowed.
maxExitDurationPerGPRStringThe maximum exit duration per GPU Pod Request.
requeueOnFailureBooleanThis parameter is to enable requeue requests on failure.
enableAutoEvictionBooleanThis parameter is to enable auto eviction for the workspace.
globalGPUConstraintsObjectThe global GPU constraints configuration.
globalGPUConstraints.gpuShapesArray[string]The list of allowed GPU shapes.
globalGPUConstraints.maxGPUPerGprIntegerThe maximum GPUs per GPU Pod Request.
globalGPUConstraints.maxMemoryPerGprIntegerThe 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

ParameterParameter TypeDescriptionRequired
policyNameStringThe name of the workspace policy you want to update.Mandatory
priorityRangeStringThe priority range configuration for the workspace.Optional
maxGPRsIntegerThe maximum number of GPU Pod Requests allowed.Optional
maxExitDurationPerGPRStringThe maximum exit duration per GPU Pod Request.Optional
enforceIdleTimeOutBooleanThe parameter to enforce idle timeout for GPU Pod Requests.Optional
requeueOnFailureBooleanThe parameter to requeue requests on failure.Optional
enableAutoEvictionBooleanThe parameter to enable auto eviction for the workspace.Optional
gpuShapesArray[string]The list of allowed GPU shapes.Optional
maxGpuPerGprIntegerThe maximum GPUs per GPU Pod Request.Optional
maxMemoryPerGprIntegerThe 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}}"
}
}