Get a compute resource¶
Retrieve the configuration, capacity, and current status of a compute resource.
GET $CLOUDSIGMA_API_BASE/compute-resources/{resource_id}
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
Obtain the compute resource ID from List compute resources or from the response returned when you create a compute resource.
Store the compute resource ID in an environment variable:
export RESOURCE_ID="<compute-resource-id>"
Request¶
curl "$CLOUDSIGMA_API_BASE/compute-resources/$RESOURCE_ID" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID"
Path parameters
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
ID of the compute resource to retrieve. |
Successful response¶
The API returns HTTP 200 and the compute resource in data.
{
"code": "OK",
"msg": "OK",
"data": {
"id": "cr-001",
"name": "data-processing",
"kind": "task",
"spec_id": "task-standard-small",
"status": "ACTIVE",
"status_message": "",
"min_replicas": 0,
"max_replicas": 2,
"current_replicas": 1
}
}
Response envelope¶
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
Human-readable result message. |
|
object |
Retrieved compute resource. |
Identity and configuration¶
Field |
Type |
Description |
|---|---|---|
|
string |
Compute resource ID. |
|
string |
ID of the workspace that owns the resource. |
|
string |
Compute resource name. |
|
string |
Compute resource description, when provided. |
|
string |
Compute specification ID. |
|
string |
Compute resource type. |
|
integer |
Allocated CPU capacity. |
|
integer |
Allocated memory in GiB. |
|
integer |
Allocated GPU capacity. |
|
integer |
Allocated CPU capacity in millicores. |
|
integer |
Allocated memory in MiB. |
|
integer |
Number of allocated GPUs. |
|
integer |
Memory per GPU in MiB. |
|
integer |
Number of GPU cores. |
|
string |
Go worker image ID, when configured. |
|
string |
Python worker image ID, when configured. |
|
object[] |
Worker images assigned to the resource. |
|
string |
Worker type. |
|
string |
Image ID. |
|
string |
Worker image platform. |
|
string |
Runtime platform, when provided. |
Capacity and status¶
Field |
Type |
Description |
|---|---|---|
|
integer |
Minimum number of replicas. A serverless resource uses |
|
integer |
Maximum number of replicas. |
|
integer |
Requested number of replicas. |
|
integer |
Current number of replicas. |
|
integer |
Inactivity period, in minutes, before automatic suspension. |
|
boolean |
Whether this is the workspace’s default compute resource. |
|
string |
Current lifecycle state, such as |
|
string |
Additional status information. |
|
string |
Reason for the most recent scaling decision, when provided. |
|
string |
Time of the most recent activation, when available. |
|
string |
Time the resource was most recently active, when available. |
|
string |
Creator ID; returned if there is a value. |
|
string |
Creation time. |
|
string |
Last update time. |
In a field path, [] represents each item in an array. For example, data.worker_images[].worker_type is the worker_type of each object in data.worker_images.
Error response¶
{
"code": "NOT_FOUND",
"msg": "对象不存在",
"data": null
}
Common HTTP errors¶
HTTP status |
Error code |
Common cause |
Recommended action |
|---|---|---|---|
|
— |
Missing or invalid access credentials. |
Check the regional endpoint and API key. |
|
|
The current identity does not have permission to read the compute resource. |
Ask a workspace administrator to grant the required permission. |
|
|
The compute resource does not exist in the selected workspace. |
Check |
Follow-up operations¶
After retrieving the resource, you can: